public ActionResult ResourcePublicationIndex() { ResourcePublicationModel db = new ResourcePublicationModel(); db.ResourcePublicationList = _iResourcePublicationService.GetResourcePublicationList(); return(View(db)); }
public ActionResult CreateEditResourcePublication(ResourcePublicationModel rpModel) { if (ModelState.IsValid) { var result = _iResourcePublicationService.CreateEditResourcePublication(rpModel); return(Json(result, JsonRequestBehavior.AllowGet)); } else { return(Json(rModel, JsonRequestBehavior.AllowGet)); } }
public ActionResult CreateEditResourcePublication(int?PublicationId) { ResourcePublicationModel rpModel = new ResourcePublicationModel(); ViewBag.CountryName = new SelectList(_iCountry.GetCountryList(), "CountryId", "CountryName"); if (PublicationId != null) { rpModel = _iResourcePublicationService.GetResourcePublicationList().Where(x => x.PublicationId == PublicationId).FirstOrDefault(); } return(PartialView("_CreateEditResourcePublication", rpModel)); }
public ReturnMessageModel CreateEditResourcePublication(ResourcePublicationModel rpModel) { try { using (PointOfSaleEntities _context = new PointOfSaleEntities()) { var rtRow = _context.ResourcePublications.Where(x => x.PublicationId == rpModel.PublicationId).FirstOrDefault(); if (rtRow == null) { rtRow = new ResourcePublication(); } rtRow.Publisher = rpModel.Publisher; rtRow.PublisherOrigin = rpModel.PublisherOrigin; rtRow.Genere = rpModel.Genere; rtRow.IsActive = rpModel.IsActive; if (rpModel.PublicationId == 0) { rtRow.CreatedBy = WebSecurity.CurrentUserId; rtRow.CreatedDate = System.DateTime.Now; _context.ResourcePublications.Add(rtRow); _context.SaveChanges(); } else { rtRow.ModifiedBy = WebSecurity.CurrentUserId; rtRow.ModifiedDate = System.DateTime.Now; _context.ResourcePublications.Attach(rtRow); _context.Entry(rtRow).State = EntityState.Modified; _context.SaveChanges(); } rModel.Msg = "Resource Type Saved Successfully"; rModel.Success = true; return(rModel); } } catch (Exception ex) { rModel.Msg = "Resource Type Saved Failed"; rModel.Success = false; return(rModel); } }