コード例 #1
0
        public ActionResult Add(SIMREG_REQUESTEDTYPEViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    _boSIMREG_REQUESTEDTYPE = new BOSIMREG_REQUESTEDTYPE();

                    var beSIMREG_REQUESTEDTYPE = new BESIMREG_REQUESTEDTYPE
                    {
                        REQUESTEDTYPEID = model.REQUESTEDTYPEID,
                        TITLE = model.TITLE,
                        IDATE = DateTime.Now,
                        IUSER = model.IUSER,
                        EDATE = DateTime.Now,
                        EUSER = model.EUSER,
                        IsNew = true
                    };

                    _boSIMREG_REQUESTEDTYPE.Save(beSIMREG_REQUESTEDTYPE);

                    return Content(Boolean.TrueString);
                }

                return Content(ExceptionHelper.ModelStateErrorFormat(ModelState));
            }
            catch (Exception ex)
            {
                ExceptionHelper.ExceptionMessageFormat(ex);
                return Content("Sorry! Unable to add this data.");
            }
        }
コード例 #2
0
        public ActionResult Edit(SIMREG_REQUESTEDTYPEViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    _boSIMREG_REQUESTEDTYPE = new BOSIMREG_REQUESTEDTYPE();

                    var sIMREG_REQUESTEDTYPE = _boSIMREG_REQUESTEDTYPE.GetSIMREG_REQUESTEDTYPE(model.REQUESTEDTYPEID);

                    if (sIMREG_REQUESTEDTYPE != null)
                    {
                        sIMREG_REQUESTEDTYPE.REQUESTEDTYPEID = model.REQUESTEDTYPEID;
                        sIMREG_REQUESTEDTYPE.TITLE = model.TITLE;
                        //sIMREG_REQUESTEDTYPE.IDATE = DateTime.Now;
                        //sIMREG_REQUESTEDTYPE.IUSER = model.IUSER;
                        sIMREG_REQUESTEDTYPE.EDATE = DateTime.Now;
                        sIMREG_REQUESTEDTYPE.EUSER = model.EUSER;
                        sIMREG_REQUESTEDTYPE.IsNew = false;

                        _boSIMREG_REQUESTEDTYPE.Save(sIMREG_REQUESTEDTYPE);

                        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.");
            }
        }