public ActionResult Edit(int id, FormCollection collection)
        {
            var updatedModel = new FrequencyViewModel
            {
                Id       = id,
                Name     = Request.Form["Name"],
                Archived = Request.Form["Archived"] == "true"
            };

            try
            {
                var json     = new JavaScriptSerializer().Serialize(updatedModel);
                var response = _apiHelper.Put(CompileUrl(apiAction) + $"?id={id}", json);

                TempData["MessageType"] = "Info";
                TempData["Message"]     = $"Frequency, {Request.Form["Name"]}, Edited";
                return(RedirectToAction("Index", ViewBag));
            }
            catch
            {
                TempData["MessageType"] = "Danger";
                TempData["Message"]     = $"There was a problem updating this record. Please try again or contact your system administrator.";
                return(View());
            }
        }
示例#2
0
        public IActionResult GetFrequencies(FrequencyViewModel frequencyViewModel)
        {
            StudentBL studentBL            = new StudentBL(_unitOfWork, _mapper);
            var       filterForFrequencies = studentBL.GetFrequency(frequencyViewModel.AbsenceCount, frequencyViewModel.FacultyName, frequencyViewModel.GroupName);
            var       filterViewModel      = this._mapper.Map <Filter, FilterViewModel>(filterForFrequencies);

            return(View("~/Views/Student/GetFrequenciesPost.cshtml", filterViewModel));
        }
        public ActionResult FrequencyMaintenance()
        {
            GetUserInfo();
            FrequencyViewModel viewModel = new FrequencyViewModel()
            {
                Frequencies = _frequencyRepository.Frequency.Where(a => a.IsActive == true),
                CanUserEdit = UserCanEdit
            };


            return(View("FrequencyMaintenance", viewModel));
        }
        public ActionResult FrequencyCreate()
        {
            GetUserInfo();
            bool canuseredit = CanUserEdit();


            FrequencyViewModel viewModel = new FrequencyViewModel()
            {
                CanUserEdit = canuseredit
            };

            return(View());
        }
        public ActionResult FrequencyEdit(int id_)
        {
            GetUserInfo();
            bool canuseredit             = CanUserEdit();
            FrequencyViewModel viewModel = new FrequencyViewModel()
            {
                CanUserEdit = canuseredit,
                Frequency   = _frequencyRepository.Frequency.FirstOrDefault(a => a.FrequencyID == id_)
            };

            viewModel.IsActive = viewModel.Frequency.IsActive;
            return(View(viewModel));
        }
        public ActionResult FrequencyCreate(FrequencyViewModel viewModel_)
        {
            if (viewModel_.Frequency.Description_EN == null)
            {
                ModelState.AddModelError("FrequencyCreateError", "An English description is required.");
            }



            GetUserInfo();

            if (ModelState.IsValid)
            {
                int Frequencyid = 0;
                viewModel_.Frequency.Description_EN = viewModel_.Frequency.Description_EN;
                viewModel_.Frequency.Description_MX = viewModel_.Frequency.Description_MX;
                viewModel_.Frequency.Description_CN = viewModel_.Frequency.Description_CN;
                viewModel_.Frequency.IsActive       = true;
                viewModel_.Frequency.Notes          = viewModel_.Frequency.Notes;
                viewModel_.Frequency.CreateDate     = DateTime.Now;
                viewModel_.Frequency.CreatedBy      = username;
                viewModel_.Frequency.LastEditDate   = DateTime.Now;
                viewModel_.Frequency.LastEditBy     = username;


                Frequencyid = _frequencyRepository.Insert(viewModel_.Frequency);
                this.ShowSaveSuccessfull();
                string anchor = "frequency" + Frequencyid.ToString();


                FrequencyViewModel viewModel = new FrequencyViewModel()
                {
                    Frequencies  = _frequencyRepository.Frequency.Where(a => a.IsActive == true),
                    CanUserEdit  = UserCanEdit,
                    returnanchor = anchor
                };



                return(View("FrequencyMaintenance", viewModel));
            }
            else
            {
                return(View(viewModel_));
            }
        }
示例#7
0
        // GET: Connectivity
        public ActionResult Index()
        {
            dtbs15Entities db = new dtbs15Entities();

            var con = db.Connectivities.ToList();
            List <FrequencyViewModel> fc = new List <FrequencyViewModel>();

            foreach (var c in con)
            {
                FrequencyViewModel f = new FrequencyViewModel();

                f._2G_Band = c.C2G_Band;
                f._3G_Band = c.C3G_Band;
                f._4G_Band = c.C4G_Band;
                fc.Add(f);
            }
            return(View(fc));
        }
示例#8
0
        public ActionResult Edit(int id, FrequencyViewModel collection)
        {
            try
            {
                dtbs15Entities db  = new dtbs15Entities();
                Connectivity   con = new Connectivity();
                var            c   = db.Connectivities.Where(x => x.id == id).SingleOrDefault();
                c.C2G_Band = collection._2G_Band;
                c.C3G_Band = collection._3G_Band;
                c.C4G_Band = collection._4G_Band;
                db.SaveChanges();
                // TODO: Add update logic here

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
示例#9
0
        public ActionResult Create(FrequencyViewModel collection)
        {
            try
            {
                // TODO: Add insert logic here

                dtbs15Entities db = new dtbs15Entities();
                Connectivity   c  = new Connectivity();
                c.C2G_Band = collection._2G_Band;
                c.C3G_Band = collection._3G_Band;
                c.C4G_Band = collection._4G_Band;
                db.Connectivities.Add(c);
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }