Example #1
0
        public IActionResult MoneyEdit(moneyViewModel model)
        {
            var response = ResponseModelFactory.CreateInstance;

            using (_dbContext)
            {
                var entity = _dbContext.ElectronicBill.FirstOrDefault(x => x.ElectronicUuid == model.ElectronicUUID);
                if (entity == null)
                {
                    response.SetFailed("不存在");
                    return(Ok(response));
                }

                entity.PurchaseTime   = model.PurchaseTime;
                entity.Phone          = model.Phone;
                entity.Supplier       = model.Supplier;
                entity.CuisineName    = model.CuisineName;
                entity.ProducedTime   = model.ProducedTime;
                entity.Specification  = model.Specification;
                entity.Quantity       = model.Quantity;
                entity.ExpirationTime = model.ExpirationTime;
                entity.Rt             = model.RT;

                _dbContext.SaveChanges();
                response = ResponseModelFactory.CreateInstance;
                return(Ok(response));
            }
        }
Example #2
0
        public IActionResult Create(moneyViewModel model)
        {
            var response = ResponseModelFactory.CreateInstance;

            //if (string.IsNullOrEmpty(AuthContextService.CurrentUser.SchoolUuid))
            //{
            //    response.SetFailed("");
            //    return Ok(response);
            //}
            using (_dbContext)
            {
                var entity = new HaiKanStudentDiningManagementSystem.Api.Entities.ElectronicBill();
                entity.ElectronicUuid = Guid.NewGuid();
                entity.IsDelete       = 0;
                entity.PurchaseTime   = model.PurchaseTime;
                entity.Phone          = model.Phone;
                entity.Supplier       = model.Supplier;
                entity.CuisineName    = model.CuisineName;
                entity.ProducedTime   = model.ProducedTime;
                entity.Specification  = model.Specification;
                entity.Quantity       = model.Quantity;
                entity.SchoolUuid     = model.SchoolUuid;
                entity.ExpirationTime = model.ExpirationTime;
                entity.Rt             = model.RT;
                entity.AddPeople      = AuthContextService.CurrentUser.DisplayName;
                entity.AddTime        = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                _dbContext.ElectronicBill.Add(entity);
                _dbContext.SaveChanges();

                response.SetSuccess();
                return(Ok(response));
            }
        }