public JsonResult LoginHello() { var result = new JsonAnswer(); result.Ok = true; return(Json(true)); }
public JsonResult LoginAdmin([FromBody] LoginDto dto) { var result = new JsonAnswer(); if (dto.Login == "admin" && dto.Password == "admin") { result.Ok = true; return(Json(result)); } return(Json(result)); }
public JsonResult Login([FromBody] LoginDto dto) { var currentUser = _db.Users.FirstOrDefault(user => user.Name == dto.Login && user.Password == dto.Password); var result = new JsonAnswer(); if (currentUser == null) { return(Json(result)); } result.Ok = true; result.UserId = currentUser.Id; return(Json(result)); }
public JsonResult Login([FromBody] LoginDto dto) { var currentUser = _users.GetUserByLoginAndPassword(dto.Login, dto.Password); var result = new JsonAnswer(); if (currentUser == null) { return(Json(result)); } result.Ok = true; result.UserId = currentUser.Id; return(Json(result)); }
public JsonResult ConfirmOrderByAdmin([FromBody] ConfirmOrderByUserDto dto) { var order = _orders.GetById(dto.OrderId); var result = new JsonAnswer(); if (order == null) { return(Json(result)); } order.OrderStatus = OrderStatus.ConfirmedByAdmin; _orders.UpdateOrder(order); result.Ok = true; return(Json(result)); }
public JsonResult ConfirmOrderByAdmin([FromBody] ConfirmOrderByUserDto dto) { var order = _db.Orders.FirstOrDefault(_ => _.Id == dto.OrderId); var result = new JsonAnswer(); if (order == null) { return(Json(result)); } order.OrderStatus = OrderStatus.ConfirmedByAdmin; _db.SaveChanges(); result.Ok = true; return(Json(result)); }