Example #1
0
        /// <summary>
        /// Save inflation index details
        /// </summary>
        /// <param name="model">model Object</param>
        public ActionResult InflationIndexSave(MODEL.InflationIndex model)
        {
            try
            {
                bool ismodelValid = ModelState.IsValid;
                if (!ismodelValid)
                {
                    ismodelValid = IsModelValidForMultilineTextbox("Description", model.Description, 30);
                }

                if (ismodelValid)
                {
                    //Get user id
                    int?userId = Session.GetUserId();
                    InflationIndexService inflationIndexService = new InflationIndexService();
                    //InflationIndexVO inflationIndexVO = new InflationIndexVO(model, userId);

                    InflationIndexVO inflationIndexVO = model.Transpose(userId);

                    inflationIndexService.SaveInflationIndex(inflationIndexVO);
                    return(new HttpStatusCodeResult(200));
                }
                else
                {
                    throw new ApplicationException(String.Format(Constants.CANNOT_SAVE, Constants.INDEX));
                }
            }
            catch (Exception e)
            {
                return(new HttpStatusCodeAndErrorResult(500, e.Message));
            }
        }
Example #2
0
 /// <summary>
 /// Create new Inflation index
 /// </summary>
 /// <returns>The InflationIndexDetails view</returns>
 public ActionResult InflationIndexCreate()
 {
     try
     {
         MODEL.InflationIndex inflationIndex = new MODEL.InflationIndex();
         return(PartialView("InflationIndexDetails", inflationIndex));
     }
     catch (Exception e)
     {
         return(new HttpStatusCodeAndErrorResult(500, e.Message));
     }
 }
Example #3
0
        /// <summary>
        /// Edit inflation index
        /// </summary>
        /// <param name="id">Inflation Index Id</param>
        /// <returns>The Inflation Index Details view</returns>
        public ActionResult InflationIndexEdit(int id)
        {
            MODEL.InflationIndex inflationIndex = null;
            try
            {
                InflationIndexService inflationIndexService = new InflationIndexService();

                //Get index details
                InflationIndexVO inflationIndexVO = inflationIndexService.GetInflationIndexById(id);
                if (inflationIndexVO == null)
                {
                    ModelState.AddModelError("", String.Format(Constants.ITEM_NOT_FOUND, Constants.INDEX));
                }
                else
                {
                    inflationIndex = new MODEL.InflationIndex(inflationIndexVO);
                }
            }
            catch (Exception e)
            {
                ModelState.AddModelError("", e.Message);
            }
            return(PartialView("InflationIndexDetails", inflationIndex));
        }