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); }
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); }
public async Task <Purchase> CreateAsync(PurchaseCreateApiModel created, int departmentId, int userId) { return(await _purchaseContext.CreateAsync(created, departmentId, userId)); }
public async Task<JsonResult> PostAsync(PurchaseCreateApiModel created) { var data = await _PurchaseService.CreateAsync(created, HospitalDepartment.Id, Profile.Id); return Json(data); }