public async Task AddProperty(SubmitPropertyModel propertyModel, string user) { var property = _mapper.Map <EstateUnit>(propertyModel); property.PostedBy = user; property.Reason = propertyModel.Reason; property.Status = "0"; property.DatePosted = DateTime.Today; property.DateAvailable = DateTime.Today; property.EstateImages = propertyModel.Images; await _propertyRepository.AddAsync(property); await _unitOfWork.SaveChangesAsync(); }
public async Task <IActionResult> Submit(SubmitPropertyModel model, ICollection <IFormFile> images) { var notification = NotificationType.Success; try { model.Images = ProcessImageFileData(images); await _propertyViewModelService.AddProperty(model, User.Identity.Name); } catch { notification = NotificationType.Error; } return(RedirectToAction(nameof(Submit), new { notification })); }