public static List <InventDoseDTO> GetById(int id) { var list = InventDoseDAL.GetById(id); List <InventDoseDTO> dalList = new List <InventDoseDTO>(); foreach (var item in list) { var i = InventDoseCast.ToDTO(item); i.StatusName = StatusDoseBL.GetByIdStatusInventDose(i.IdStatusInvent).Trim(); i.InventDetails = InventDetailsCast.ListToDTO(InventDoseDAL.GetByIdInventDetails(i.Id)); foreach (var menu in i.InventDetails) { var m = MenuDAL.GetById(menu.IdMenu); menu.MenuName = m.NameDose; } dalList.Add(i); } return(dalList); }
public static List <InventDoseDTO> GetAll() { var dal = InventDoseDAL.GetAll(); List <InventDoseDTO> dalList = new List <InventDoseDTO>(); foreach (var item in dal) { var i = InventDoseCast.ToDTO(item); i.StatusName = InventDoseDAL.GetByIdStatusInvent(i.IdStatusInvent).Kind.Trim(); i.VisiterName = VisitersDAL.GetById(i.IdVisiter).FirstName; i.InventDetails = InventDetailsCast.ListToDTO(InventDoseDAL.GetByIdInventDetails(i.Id)); foreach (var menu in i.InventDetails) { var m = MenuBL.GetById(menu.IdMenu); menu.MenuName = m.NameDose; } dalList.Add(i); } return(dalList); }
public static List <FavoriteDose> getDoseByfeedback() { List <FavoriteDose> favorite = new List <FavoriteDose>(); var list = InventDoseCast.ListToDTO(InventDoseDAL.GetDoseByfeedback()); foreach (var item in list) { var f = new FavoriteDose(); var name = VisitersDAL.GetById(item.IdVisiter); f.VisiterName = name.FirstName.Trim() + " " + name.LastName.Trim(); f.Feedback = item.Feedback.Trim(); f.date = DateTime.Now; f.rate = item.rate; item.InventDetails = InventDetailsCast.ListToDTO(InventDoseDAL.GetByIdInventDetails(item.Id)); foreach (var menu in item.InventDetails) { f.Menu = MenuBL.GetById(menu.IdMenu); } favorite.Add(f); } return(favorite); }