예제 #1
0
        public JsonResult Create([FromBody] Users user)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    //Users userObj = JsonConvert.DeserializeObject<Users>(user);
                    user.Application = "PAYROLL";//ViewBag("Application");
                    // TODO: Add update logic here
                    _context.Add(user);
                    _context.SaveChanges();
                }

                return(Json(new { Success = true }));
            }
            catch
            {
                throw;
            }
        }
예제 #2
0
        public JsonResult Create(string role)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    Roles roleObj = JsonConvert.DeserializeObject <Roles>(role);
                    roleObj.Application = "Payroll";//ViewBag("Application");
                    // TODO: Add update logic here
                    //_context.Update(user);
                    _context.Add(roleObj);
                    _context.SaveChanges();
                }

                return(Json(new { Success = true }));
            }
            catch (Exception)
            {
                throw;
            }
        }