backend with .Net [closed] - c#

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed yesterday.
Improve this question
here is the whole association model of my database
the problem is that I need to read the list of Equipment displayed at each Employee
*An employee has one or more Post
*A Post has one or more Equipment
I created the backend part with .NET
I tried to read the list of posts of an employee and then read the list of Equipment by the id of each post
/*********************************/
[HttpGet]
public async Task<IEnumerable<GetEquiPostDto>> GetEmpPostListAsync(string id)
{
var EmpPost=(await PostRepository.GetEmppPostAsync(id))
.Select(EmpPost=>EmpPost.GetEmpPostDto()).ToList();
for(int i=0;i<EmpPost.Count;i++)
{
var EquiPost=(await EquipRepository.GetEquippPostAsync(EmpPost[i].PostId))
.Select(EquiPost=>EquiPost.GetEquiPostDto());
}
return EquiPost;
}

Related

Why does this LINQ not work? Im trying to get All Countries from a class (only countries [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 months ago.
Improve this question
I'm trying to get all Countries from my database for a combo box.
This is my code for it:
public IQueryable<Customer> GetAllCountries()
{
var query = from e in Entities
select e.Country;
return query;
}
It gives me an error at return query;
I only want the Countries for my combo box, even though there are cities and all sorts in the Customer class.
I managed to fix it by using IQueriable<string> instead of Customer!

C# how to get diagram name of element - Enterprise Architect [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I need to get diagram`s name of specific elements. Is it possible ?
I added elements note with specific stereotypu using profile to EA project. Then i want create a plugin where i find this notes and diagram names where they are located. (i want export notes and diagram names to excel)....PS: Sorry for my bad english
Issue a SQL like
Repository.SQLQuery("SELECT t_diagram.name FROM t_diagramobjects AS dobj INNER JOIN t_diagram ON dobj.diagram_id = t_diagram.diagram_id WHERE t_diagramobjects.Object_ID = <elementID>"
Just replace <elementID> with the element's elementID. You could alternatively retrieve the diagram GUID (t_diagram.ea_guid') and get the diagram details viaRepostory.GetDiagramByGUID`.

MVC model not saving the value [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
var ticketnumber = TempData["ticketId"] as Ticket;
ticketnumber.TicketId = model.TicketId;
db.SaveChanges();
HttpPostedFileBase file = Request.Files["ImageData"];
UploadRepository service = new UploadRepository();
int i = service.UploadImageInDataBase(file, model);
I have the value inside my tempdata but when i try to assign the value of it to the model value it doesnt save and even in debug it tells me the value hasnt changed so i just dont get what i am doing wrong.
You need to change the assignment:
From:
ticketnumber.TicketId = model.TicketId;
To:
model.TicketId = ticketnumber.TicketId;

Searching an object in a collection via lambda and does not return true even if it exist [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
https://www.youtube.com/watch?v=K1xrlc32Tmw&list=PLJUoF2h8Z-brW94dTZ-ZIOhjFq90_lt5K&index=9
4:25 adds a new object in the lineCollection if product does not exist in lineCollection, but at 24:25 it shows duplicating orders? Did i misunderstood how it works?
https://github.com/jedjad/GitHubVS2013
Because the products in duplicate values are not same objects. They may have same names, quantity etc, but initializing a class with same values does not mean that it is the same object as the one initialized before. They are like 2 different apples with same color and size.
If you say that 2 products are same whenever the names are same, then implement IEquatable<Product> in Product class.
public bool Equals(Product other)
{
return Name == other.Name;
}

Accessing object item c# [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have an object passed into a function. Now I want to access the object item like we have in the class function (EX: obj a: a.name):
I want to access level obejct slaType item.
"level.slaType"
You need to cast level object to that particular class type..
LevelType levelObject = level as LevelType;
if(levelObject != null)
{
levelObject.slaType;
}

Categories