public async Task <bool> UpdateArticle(ZabotaArticles model) { model.Date = DateTimeOffset.UtcNow; await _articlesRepository.Update(model); return(true); }
public Task Add(ZabotaArticles model) { var path = _uploadPath.GetPath(); _appDBContext.Articles.Add(new Entities.Articles { Name = model.Name, Description = model.Description, Img = "~/" + path.BaseImagePath + "/" + path.Articles + "/" + model.IMG, Date = DateTimeOffset.UtcNow, CategoryID = model.CategoryID, DepartmentId = model.DepartmentId }); return(_appDBContext.SaveChangesAsync()); }
public Task Update(ZabotaArticles model) { _appDBContext.Articles .AsQueryable() .Where(x => x.Id == model.Id) .Update(r => new Entities.Articles { Id = model.Id, Name = model.Name, Description = model.Description, Img = model.IMG, Date = model.Date, CategoryID = model.CategoryID, DepartmentId = model.DepartmentId }); return(_appDBContext.SaveChangesAsync()); }
public async Task <bool> AddArticle(ZabotaArticles model) { await _articlesRepository.Add(model); return(true); }