Exemplo n.º 1
0
        public ActionResult Index(int?id)
        {
            try
            {
                FrequencyTypeViewModel frequencytypeviewmodel = new FrequencyTypeViewModel();
                if (id == null)
                {
                    id = (int)TempData["daId"];
                }

                frequencytypeviewmodel = frequencytypeviewmodel.GetFreqType(id);
                frequencytypeviewmodel.GetScreenAccessRights("Frequency Type");
                CommonFunctions comfuns = new CommonFunctions();

                var da = comfuns.FindDA((int)id);
                frequencytypeviewmodel.daid     = (int)id;
                frequencytypeviewmodel.ModuleId = da.ModuleId;
                frequencytypeviewmodel.daName   = da.DAName;
                TempData["daId"] = frequencytypeviewmodel.daid;

                return(View(frequencytypeviewmodel));
            }
            catch (Exception ex)
            {
                errorlogviewmodel = new ErrorLogViewModel();
                errorlogviewmodel.LogError(ex);
                return(View("Error"));
            }
        }
Exemplo n.º 2
0
        public ActionResult Index(FrequencyTypeViewModel frequencytypeviewmodel)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    frequencytypeviewmodel.FreqTypeDesc = frequencytypeviewmodel.FreqTypeDesc.Trim();
                    frequencytypeviewmodel.AddFrequencyType(frequencytypeviewmodel);
                    TempData["daId"] = frequencytypeviewmodel.daid;
                    frequencytypeviewmodel.GetScreenAccessRights("Frequency Type");
                    return(RedirectToAction("Index", "FrequencyType"));
                }
                frequencytypeviewmodel = frequencytypeviewmodel.GetFreqType(frequencytypeviewmodel.daid);

                return(View(frequencytypeviewmodel));
            }
            catch (Exception ex)
            {
                errorlogviewmodel = new ErrorLogViewModel();
                errorlogviewmodel.LogError(ex);
                return(View("Error"));
            }
        }