public async Task <IActionResult> CreateRetail([FromForm] RetailViewModel model) { try { if (_groupRepository.GetGroup(model.GroupId) == null) { return(Error((int)HttpStatusCode.BadRequest)); } await _retailRepository.AddRetail(new RetailModel() { Name = model.Name, GroupId = model.GroupId, CreateDate = DateTime.Now, ModificationDate = DateTime.Now }); _eventLog.EventPublish("Create: ", $"{model.RetailId} : {model.Name} at {DateTime.Now}"); return(Ok(model.Name + " Successfully created")); } catch (Exception ex) { return(Error((int)HttpStatusCode.BadRequest, ex)); } }