//------------------All vendero of all outlet---------------------// public ActionResult VenderReport() { var data = (from p in db.tblVendors where p.Active == true select p).ToList(); List <VenderRegistrationModel> model = new List <VenderRegistrationModel>(); foreach (var item in data) { VenderRegistrationModel v = new VenderRegistrationModel(); v.Address = item.Address; v.ContactA = item.ContactA; v.ContactB = item.ContactB; v.Email = item.Email; v.Name = item.Name; v.OutletId = item.OutletId; v.RegistrationDate = item.RegistrationDate; v.TinNo = item.TinNo; v.VendorId = item.VendorId; v.OutletId = item.OutletId; model.Add(v); } return(View(model)); }
public ActionResult VenderRegistration(int id = 0) { ViewBag.lstofoutlet = new AddItemRepository().GetListofOutlet(); if (id > 0) { var data = (from p in db.tblVendors.Where(o => o.VendorId == id) select p).SingleOrDefault(); VenderRegistrationModel model = new VenderRegistrationModel(); model.Address = data.Address; model.ContactA = data.ContactA; model.ContactB = data.ContactB; model.Email = data.Email; model.Name = data.Name; model.OutletId = data.OutletId; model.RegistrationDate = data.RegistrationDate; model.TinNo = data.TinNo; model.GSTin = data.GSTin; model.IfscCode = data.IfscCode; model.Pan = data.Pan; model.ServiceTax = (decimal)(data.ServiceTax == null ? 0 : data.ServiceTax); model.AccountName = data.AccountName; model.AccountNumber = data.AccountNumber; model.Bank = data.Bank; model.Branch = data.Branch; model.Paymentcycle = data.Paymentcycle; model.VendorId = data.VendorId; return(View(model)); } else { return(View()); } }
public ActionResult VenderRegistration(VenderRegistrationModel model) { try { tblVendor tb = new tblVendor(); tblLedgerMaster tbl = new tblLedgerMaster(); int Uname = getOutletId(); if (model.VendorId > 0) { tb = (from p in db.tblVendors where p.VendorId == model.VendorId select p).SingleOrDefault(); } tb.Address = model.Address; tb.ContactA = model.ContactA; tb.ContactB = model.ContactB; tb.Email = model.Email; tb.Name = model.Name; tb.OutletId = 99; tb.RegistrationDate = DateTime.Now; tb.TinNo = model.TinNo; tb.GSTin = model.GSTin; tb.IfscCode = model.IfscCode; tb.Pan = model.Pan; tb.ServiceTax = (decimal)(model.ServiceTax == null ? 0 : model.ServiceTax); tb.AccountName = model.AccountName; tb.AccountNumber = model.AccountNumber; tb.Bank = model.Bank; tb.Branch = model.Branch; tb.Paymentcycle = model.Paymentcycle; tb.Active = model.Active; if (db.tblLedgerMasters.Select(p => p.RecordId).Count() > 0) { tbl.RecordId = db.tblLedgerMasters.Select(p => p.RecordId).Max() + 1; } else { tbl.RecordId = 1; } tbl.LedgerName = model.Name; tbl.LedgerGroup = 3; tbl.Date = DateTime.Now; if (model.VendorId > 0) { db.SaveChanges(); TempData["Message"] = "Edit Successfully !"; } else { db.tblVendors.Add(tb); db.SaveChanges(); tbl.VendorId = tb.VendorId; db.tblLedgerMasters.Add(tbl); db.SaveChanges(); TempData["Message"] = "Insert Successfully !"; } } catch (Exception ex) { TempData["Message"] = ex.Message; } return(RedirectToAction("Vender")); }