示例#1
0
        public async Task <Purchase> CreateAsync(PurchaseCreateApiModel created, int departmentId, int userId)
        {
            var purchase = _purchaseRespository.Create(created, departmentId, userId);

            if (created.PurchaseSettingId != null)
            {
                await _bus.PublishAsync("purchase.generate", new RabbitMqMessage <int> {
                    Payload = purchase.Id
                });

                _purchaseRespository.UpdateStatus(purchase.Id, PurchaseStatus.Generating);
            }
            return(purchase);
        }
示例#2
0
        public Purchase Create(PurchaseCreateApiModel created, int departmentId, int userId)
        {
            var setting = new Purchase
            {
                HospitalDepartmentId = departmentId,
                CreateUserId         = userId,
                CreateTime           = DateTime.Now,
                Name              = created.Name,
                Remark            = created.Remark,
                Status            = (int)PurchaseStatus.Pendding,
                PurchaseSettingId = created.PurchaseSettingId,
            };

            _context.Purchase.Add(setting);
            _context.SaveChanges();

            return(setting);
        }
示例#3
0
 public async Task <Purchase> CreateAsync(PurchaseCreateApiModel created, int departmentId, int userId)
 {
     return(await _purchaseContext.CreateAsync(created, departmentId, userId));
 }
示例#4
0
 public async Task<JsonResult> PostAsync(PurchaseCreateApiModel created)
 {
     var data = await _PurchaseService.CreateAsync(created, HospitalDepartment.Id, Profile.Id);
     return Json(data);
 }