// // GET: /NEWFORM/Add public ActionResult Add() { try { _sIMREG_REQUESTEDBYRepository = new SIMREG_REQUESTEDBYRepository(); _sIMREG_REQUESTEDTYPERepository = new SIMREG_REQUESTEDTYPERepository(); _sIMREG_DELIVEREDBYRepository = new SIMREG_DELIVEREDBYRepository(); var sIMREG_NEWFORMViewModel = new SIMREG_NEWFORMViewModel(); var sIMREG_REQUESTEDBYList = _sIMREG_REQUESTEDBYRepository.GetAll(); var sIMREG_REQUESTEDTYPEList = _sIMREG_REQUESTEDTYPERepository.GetAll(); var sIMREG_DELIVEREDBYList = _sIMREG_DELIVEREDBYRepository.GetAll(); sIMREG_NEWFORMViewModel.ddlREQUESTEDBYS = SelectListItemExtension.PopulateDropdownList(); return PartialView("_Add", sIMREG_NEWFORMViewModel); } catch (Exception ex) { ExceptionHelper.ExceptionMessageFormat(ex); return PartialView("_Error", ex); } }
public ActionResult Add(SIMREG_NEWFORMViewModel model) { try { if (ModelState.IsValid) { _sIMREG_NEWFORMRepository = new SIMREG_NEWFORMRepository(); var sIMREG_NEWFORM = new SIMREG_NEWFORM { MSISDNID = model.MSISDNID, REQUESTEDDATE = model.REQUESTEDDATE, REQUESTEDBYID = model.REQUESTEDBYID, REQUESTEDTYPEID = model.REQUESTEDTYPEID, DELIVEREDBYDATE = model.DELIVEREDBYDATE, DELIVEREDBYID = model.DELIVEREDBYID, IDATE = model.IDATE, IUSER = model.IUSER, EDATE = model.EDATE, EUSER = model.EUSER }; _sIMREG_NEWFORMRepository.Insert(sIMREG_NEWFORM); return Content(Boolean.TrueString); } return Content(ExceptionHelper.ModelStateErrorFormat(ModelState)); } catch (Exception ex) { ExceptionHelper.ExceptionMessageFormat(ex); return Content("Sorry! Unable to add this data."); } }
// // GET: /NEWFORM/Delete/by id public ActionResult Delete(int id) { try { _sIMREG_NEWFORMRepository = new SIMREG_NEWFORMRepository(); _sIMREG_REQUESTEDBYRepository = new SIMREG_REQUESTEDBYRepository(); _sIMREG_REQUESTEDTYPERepository = new SIMREG_REQUESTEDTYPERepository(); _sIMREG_DELIVEREDBYRepository = new SIMREG_DELIVEREDBYRepository(); var sIMREG_NEWFORM = _sIMREG_NEWFORMRepository.GetById(id); if (sIMREG_NEWFORM != null) { var sIMREG_NEWFORMViewModel = new SIMREG_NEWFORMViewModel { ID = sIMREG_NEWFORM.ID, MSISDNID = sIMREG_NEWFORM.MSISDNID, MSISDNTITLE = _sIMREG_MSISDNRepository.GetById(sIMREG_NEWFORM.MSISDNID).TITLE, REQUESTEDDATE = sIMREG_NEWFORM.REQUESTEDDATE, REQUESTEDBYID = sIMREG_NEWFORM.REQUESTEDBYID, REQUESTEDBYTITLE = _sIMREG_REQUESTEDBYRepository.GetById(sIMREG_NEWFORM.REQUESTEDBYID).TITLE, REQUESTEDTYPEID = sIMREG_NEWFORM.REQUESTEDTYPEID, REQUESTEDTYPETITLE = _sIMREG_REQUESTEDTYPERepository.GetById(sIMREG_NEWFORM.REQUESTEDTYPEID).TITLE, DELIVEREDBYDATE = sIMREG_NEWFORM.DELIVEREDBYDATE, DELIVEREDBYID = sIMREG_NEWFORM.DELIVEREDBYID, DELIVEREDBYTITLE = _sIMREG_DELIVEREDBYRepository.GetById(sIMREG_NEWFORM.DELIVEREDBYID).TITLE, IDATE = sIMREG_NEWFORM.IDATE, IUSER = sIMREG_NEWFORM.IUSER, EDATE = sIMREG_NEWFORM.EDATE, EUSER = sIMREG_NEWFORM.EUSER }; return PartialView("_Delete", sIMREG_NEWFORMViewModel); } else { return PartialView("_Error", "Could not found, your request data."); } } catch (Exception ex) { ExceptionHelper.ExceptionMessageFormat(ex); return PartialView("_Error", ex); } }
public ActionResult Edit(SIMREG_NEWFORMViewModel model) { try { if (ModelState.IsValid) { _sIMREG_NEWFORMRepository = new SIMREG_NEWFORMRepository(); var sIMREG_NEWFORM = _sIMREG_NEWFORMRepository.GetById(model.ID); if (sIMREG_NEWFORM != null) { sIMREG_NEWFORM.ID = model.ID; sIMREG_NEWFORM.MSISDNID = model.MSISDNID; sIMREG_NEWFORM.REQUESTEDDATE = model.REQUESTEDDATE; sIMREG_NEWFORM.REQUESTEDBYID = model.REQUESTEDBYID; sIMREG_NEWFORM.REQUESTEDTYPEID = model.REQUESTEDTYPEID; sIMREG_NEWFORM.DELIVEREDBYDATE = model.DELIVEREDBYDATE; sIMREG_NEWFORM.DELIVEREDBYID = model.DELIVEREDBYID; sIMREG_NEWFORM.IDATE = model.IDATE; sIMREG_NEWFORM.IUSER = model.IUSER; sIMREG_NEWFORM.EDATE = model.EDATE; sIMREG_NEWFORM.EUSER = model.EUSER; _sIMREG_NEWFORMRepository.Update(sIMREG_NEWFORM); return Content(Boolean.TrueString); } else { return Content("Could not found, your request data."); } } return Content(ExceptionHelper.ModelStateErrorFormat(ModelState)); } catch (Exception ex) { ExceptionHelper.ExceptionMessageFormat(ex); return Content("Sorry! Unable to edit this data."); } }