public ActionResult EditItemMasterDetails(int id = 0) { TBITEMMASTERDETAIL obj = dbContext.TBITEMMASTERDETAILs.Where(x => x.ItemMasterDetailId == id).FirstOrDefault(); if (obj == null) { return(HttpNotFound()); } ViewBag.ItemidList = GetItemId(); ViewBag.SizeidList = GetSizeId(); ViewBag.ItemMasterList = dbContext.TBITEMMASTERDETAILs.ToList(); return(View("ItemMasterDetails", obj)); }
public ActionResult GetRate(int itemId, int Sizeid) { dbContext.Configuration.ProxyCreationEnabled = false; TBITEMMASTERDETAIL ratelist = new TBITEMMASTERDETAIL(); if (itemId != 0 && Sizeid != 0) { //var TBITEMMASTERDETAIL = dbContext.TBITEMMASTERDETAILs.Where(x => x.ITEMID == Id).Select(x => x.SIZEID).ToList(); //projectslist = dbContext.TblSizeMasters.Where(x => TBITEMMASTERDETAIL.Contains(x.Id)).ToList(); var TBITEMMASTERDETAIL = dbContext.TBITEMMASTERDETAILs.Where(x => x.ITEMID == itemId && x.SIZEID == Sizeid).FirstOrDefault(); ratelist = TBITEMMASTERDETAIL; } return(Json(ratelist, JsonRequestBehavior.AllowGet)); }
public ActionResult ItemMasterHeaderSaveChanges(ItemMasterHeaderDetail obj) { TBITEMMASTERHEADER objTBITEMMASTERHEADER = new TBITEMMASTERHEADER(); TBITEMMASTERDETAIL objTBITEMMASTERDETAIL = new TBITEMMASTERDETAIL(); if (obj.ITEMID > 0) { objTBITEMMASTERHEADER = dbContext.TBITEMMASTERHEADERs.Where(x => x.ITEMID == obj.ITEMID).FirstOrDefault(); objTBITEMMASTERHEADER.ITEMNAME = obj.ITEMNAME; objTBITEMMASTERHEADER.BRANDID = obj.BRANDID; objTBITEMMASTERHEADER.ITEMGROUPID = obj.ITEMGROUPID; objTBITEMMASTERHEADER.PURTAXID = obj.PURTAXID; objTBITEMMASTERHEADER.SALETAXID = obj.SALETAXID; dbContext.SaveChanges(); } else { objTBITEMMASTERHEADER.ITEMNAME = obj.ITEMNAME; objTBITEMMASTERHEADER.BRANDID = obj.BRANDID; objTBITEMMASTERHEADER.ITEMGROUPID = obj.ITEMGROUPID; objTBITEMMASTERHEADER.PURTAXID = obj.PURTAXID; objTBITEMMASTERHEADER.SALETAXID = obj.SALETAXID; dbContext.TBITEMMASTERHEADERs.Add(objTBITEMMASTERHEADER); dbContext.SaveChanges(); var ids = dbContext.TBITEMMASTERHEADERs.OrderByDescending(p => p.ITEMID).FirstOrDefault(); if (ids.ITEMID > 0) { foreach (var item in obj.tbiitemdeatil) { objTBITEMMASTERDETAIL.ITEMID = ids.ITEMID; objTBITEMMASTERDETAIL.SIZEID = item.SIZEID; objTBITEMMASTERDETAIL.PURRATE = item.PURRATE; objTBITEMMASTERDETAIL.MRP = item.MRP; objTBITEMMASTERDETAIL.SALERATE = item.SALERATE; objTBITEMMASTERDETAIL.BARCODE = item.BARCODE; objTBITEMMASTERDETAIL.BASICRATE = item.BASICRATE; dbContext.TBITEMMASTERDETAILs.Add(objTBITEMMASTERDETAIL); dbContext.SaveChanges(); } } } // dbContext.SaveChanges(); return(RedirectToAction("ItemMasterHeader")); }
public ActionResult ItemMasterDetailsSaveChanges(TBITEMMASTERDETAIL obj) { if (obj.ItemMasterDetailId > 0) { TBITEMMASTERDETAIL objbrand = dbContext.TBITEMMASTERDETAILs.Where(x => x.ItemMasterDetailId == obj.ItemMasterDetailId).FirstOrDefault(); objbrand.ITEMID = obj.ITEMID; objbrand.SIZEID = obj.SIZEID; objbrand.BARCODE = obj.BARCODE; objbrand.BASICRATE = obj.BASICRATE; objbrand.PURRATE = obj.PURRATE; objbrand.SALERATE = obj.SALERATE; objbrand.MRP = obj.MRP; } else { dbContext.TBITEMMASTERDETAILs.Add(obj); } dbContext.SaveChanges(); return(RedirectToAction("ItemMasterDetails")); }