private async Task <BaseModel> Save(ArticleViewModel model, UsersLoginDataModel user, CommunityGroupsDataModel communityGroupsData) { CommunityArticles dataModel = new CommunityArticles { CreatedBy = model.UserId, User = user, CommunityGroups = communityGroupsData, Title = model.ArticleTitle, Description = model.ArticleDescription, ShareDocUrl = model.ShareDocument, IsActive = true, }; await _unitOfWork.UserCommunityArticlesRepository.Insert(dataModel); return(new BaseModel { Status = true, Id = dataModel.Id, Messsage = UMessagesInfo.RecordSaved }); }
private async Task <BaseModel> Update(ArticleViewModel model) { CommunityArticles dataModel = await _unitOfWork.UserCommunityArticlesRepository.GetByID(model.Id); dataModel.Title = model.ArticleTitle; dataModel.Description = model.ArticleDescription; if (!string.IsNullOrEmpty(model.ShareDocument)) { await _awsS3Bucket.DeleteFileAsync(dataModel.ShareDocUrl); dataModel.ShareDocUrl = model.ShareDocument; } dataModel.IsActive = true; dataModel.AddedDate = DateTime.Now; await _unitOfWork.UserCommunityArticlesRepository.Update(dataModel); return(new BaseModel { Status = true, Id = dataModel.Id, Messsage = UMessagesInfo.RecordSaved }); }