public async Task <IActionResult> UploadIdentificationVerification(VmIdentificationVerification model) { var storage = new FileStorageCore(dc, CurrentUserId); var frontSidePhoto = await storage.Save(model.FrontSidePhoto); var backSidePhoto = await storage.Save(model.BackSidePhoto); dc.DbTran(() => { var identification = dc.Table <UserIdentification>().FirstOrDefault(x => x.UserId == CurrentUserId); if (identification == null) { dc.Table <UserIdentification>().Add(new UserIdentification { UserId = CurrentUserId, DocumentTypeId = model.DocumentTypeId, DocumentNumber = model.DocumentNumber, IssueDate = model.IssueDate, ExpiryDate = model.ExpiryDate }); } else { identification.DocumentTypeId = model.DocumentTypeId; identification.DocumentNumber = model.DocumentNumber; identification.IssueDate = model.IssueDate; identification.ExpiryDate = model.ExpiryDate; } if (!String.IsNullOrEmpty(frontSidePhoto)) { var doc = new UserDocument { UserId = CurrentUserId, Tag = "FrontSidePhotoId", FileStorageId = frontSidePhoto }; dc.Table <UserDocument>().Add(doc); } if (!String.IsNullOrEmpty(backSidePhoto)) { var doc = new UserDocument { UserId = CurrentUserId, Tag = "BackSidePhotoId", FileStorageId = backSidePhoto }; dc.Table <UserDocument>().Add(doc); } }); return(Ok()); }
public async Task <IActionResult> UploadDocumentSignature(IFormFile file) { if (file == null) { return(Ok()); } if (file.Length == 0) { return(BadRequest("File size is zero.")); } var storage = new FileStorageCore(dc, CurrentUserId); var storageId = await storage.Save(file); dc.DbTran(() => { var doc = new UserDocument { UserId = CurrentUserId, Tag = "DocumentSignature", FileStorageId = storageId }; dc.Table <UserDocument>().Add(doc); }); return(Ok()); }