Example #1
0
 public int PutUser(user_manager _u, string _id)
 {
     /*using (employmentEntities entities = new employmentEntities())
      * {
      *  return entities.PutUser
      *  (
      *      usr
      *  );
      * }*/
     return(new executor().PutUser(_u, _id));
 }
        public async Task <ActionResult <user_manager> > Postuser_manager(user_manager user_manager)
        {
            _context.user_managers.Add(user_manager);
            await _context.SaveChangesAsync();

            return(new OkObjectResult(new
            {
                Success = true,
                Message = "Success",
                Data = CreatedAtAction("Getuser_manager", new { id = user_manager.user_manager_id }, user_manager)
            }));
        }
        public async Task <IActionResult> Putuser_manager(int id, user_manager user_manager)
        {
            if (id != user_manager.user_manager_id)
            {
                return(new OkObjectResult(new
                {
                    Success = false,
                    Message = "Not found id",
                    Data = BadRequest()
                }));
            }

            _context.Entry(user_manager).State = EntityState.Modified;

            try
            {
                return(new OkObjectResult(new
                {
                    Success = true,
                    Message = "Thay đổi thành công",
                    Data = await _context.SaveChangesAsync()
                }));
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!user_managerExists(id))
                {
                    return(new OkObjectResult(new
                    {
                        Success = false,
                        Message = "Not found id",
                        Data = NotFound()
                    }));
                }
                else
                {
                    throw;
                }
            }
        }
Example #4
0
 public int PostUser(user_manager _u)
 {
     return(new executor().PostUser(_u));
 }