public async Task <int> CreateAsync(CompanyAddModel model) { if (model == null) { return(ToResponse(0, Errors.invalid_data)); } var company = _mapper.Map <CompanySql>(model); var response = await _rpCompany.CreateAsync(company, _process.User.Id); if (response.success) { if (!string.IsNullOrWhiteSpace(model.LastNote)) { var note = new NoteAddModel { Content = model.LastNote, ProfileId = response.data, ProfileTypeId = (int)NoteType.Company, UserId = _process.User.Id }; await _rpNote.AddNoteAsync(note); } } return(ToResponse(response)); }
public IActionResult Update(int id) { Company getCompany = ICompanyServices.GetCompany(id); CompanyAddModel companyAddModel = new CompanyAddModel { ID = getCompany.CompanyID, CompanyName = getCompany.CompanyName }; return(View(companyAddModel)); }
public async Task <IResultModel> Add(CompanyAddModel model) { var entity = _mapper.Map <CompanyEntity>(model); //if (await _repository.Exists(entity)) //{ //return ResultModel.HasExists; //} var result = await _repository.AddAsync(entity); return(ResultModel.Result(result)); }
public IActionResult Add(CompanyAddModel companyAddModel) { if (!ModelState.IsValid) { return(View(companyAddModel)); } else { Company company = new Company { CompanyName = companyAddModel.CompanyName }; ICompanyServices.Add(company); return(RedirectToAction("Index", "Company")); } }
public ActionResult Add(CompanyAddModel model) { var type = Enumerations.CompanyType.money; foreach (int i in Enum.GetValues(typeof(Enumerations.CompanyType))) { if (((Enumerations.CompanyType)i).ToString().CompareTo(model.Type) == 0) { type = (Enumerations.CompanyType)i; } } var field = Enumerations.CompanyField.AutoIndustrija; foreach (int i in Enum.GetValues(typeof(Enumerations.CompanyField))) { if (((Enumerations.CompanyField)i).ToString().CompareTo(model.Field) == 0) { field = (Enumerations.CompanyField)i; } } Companys.AddCompany(model.Name, model.Address, model.City, model.Description, model.Email, model.Phone, model.Website, field, type); return(RedirectToAction("Index")); }
public Task <IResultModel> Add(CompanyAddModel model) { return(_service.Add(model)); }
public async Task <IActionResult> CreateAsync([FromBody] CompanyAddModel model) { var result = await _bizCompany.CreateAsync(model); return(ToResponse(result)); }