/// <summary> /// עדכון נתוני דף הדפסה קיים /// </summary> /// <param name="printingSheetDTO"></param> public static void UpdateSheet(PrintingSheetDTO printingSheetDTO) { SizeOfPage size = db.SizeOfPages.FirstOrDefault(s => s.sizeId == printingSheetDTO.SizeOfPage.sizeId); Price price = db.Prices.FirstOrDefault(p => p.priceId == printingSheetDTO.price.priceId); size.sizeName = printingSheetDTO.SizeOfPage.sizeName; price.priceBlackWhite = printingSheetDTO.price.priceBlackWhite; price.priceColorFull = printingSheetDTO.price.priceColorFull; db.SaveChanges(); }
//add a new size of page and return its id public static int AddSize(string sizeName) { //db.size. List <SizeOfPage> sizeList = db.SizeOfPages.ToList(); if (sizeList.FirstOrDefault(s => s.sizeName == sizeName) != null) { return(0); } SizeOfPage s1 = new SizeOfPage() { sizeName = sizeName }; sizeList.Add(s1); db.SaveChanges(); return(s1.sizeId); //למה מחזיר id }
public static SizeOfPageDTO CastToDTO(SizeOfPage sizeOfPage) { return new SizeOfPageDTO() { sizeId = sizeOfPage.sizeId, sizeName = sizeOfPage.sizeName }; }