Ejemplo n.º 1
0
        public ActionResult New(CallingViewModel model, int member, int calling, int callingFlag)
        {
            if (!isAuthenticated() || !loggedUser.isAdmin)
            {
                return(new HttpUnauthorizedResult());
            }
            else
            {
                if (ModelState.IsValid)
                {
                    Calling newCalling = new Calling();
                    Result  result     = newCalling.add(calling, member, string.Empty, model.Date, new Common().convertBool(callingFlag));
                    if (result.Success)
                    {
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        ModelState.AddModelError("", "Ocorreu um erro ao criar novo chamado");
                    }
                }

                ViewBag.unit = loggedUser.Unit;

                return(View(model));
            }
        }
Ejemplo n.º 2
0
        public ActionResult New()
        {
            if (!isAuthenticated() || !loggedUser.isAdmin)
            {
                return(new HttpUnauthorizedResult());
            }
            else
            {
                CallingViewModel model = new CallingViewModel();
                model.Date = DateTime.Now;

                ViewBag.unit = loggedUser.Unit;

                return(View(model));
            }
        }
Ejemplo n.º 3
0
        public ActionResult Edit(int id)
        {
            if (!isAuthenticated() || !loggedUser.isAdmin)
            {
                return(new HttpUnauthorizedResult());
            }
            else
            {
                CallingViewModel model = new CallingViewModel();
                Calling          call  = new Calling().get(id, loggedUser.Unit);
                model.CallingId   = call.CallingId;
                model.MemberId    = call.MemberId;
                model.CallingFlag = new Common().convertBool(call.CallingFlag);
                model.Date        = call.Date;
                model.Id          = call.Id;
                model.Other       = call.Other;

                ViewBag.unit = loggedUser.Unit;

                return(View(model));
            }
        }