Beispiel #1
0
        public async Task <JsonResponse> Update([FromBody] Carmanage carmanage)
        {
            JsonResponse result = new JsonResponse();

            try
            {
                carmanage.Date = DateTime.Now;
                var u = _context.Carmanage.Update(carmanage);
                _context.SaveChanges();
                result.Msg    = "修改车辆信息成功";
                result.Status = ErrorCode.Sucess;
            }
            catch
            {
                result.Msg    = "修改车辆信息失败";
                result.Status = ErrorCode.Unknown;
            }
            return(result);
        }
Beispiel #2
0
        public async Task <JsonResponse> Insert([FromBody] Carmanage carmanage)
        {
            JsonResponse result = new JsonResponse();

            carmanage.Id   = 0;
            carmanage.Date = DateTime.Now;
            try
            {
                _context.Add(carmanage);
                _context.SaveChanges();
                result.Msg    = "车辆信息新增成功";
                result.Status = ErrorCode.Sucess;
                return(result);
            }
            catch
            {
                result.Msg    = "车辆信息新增失败";
                result.Status = ErrorCode.Unknown;
                return(result);
            }
        }