public async Task <TransLogs> SaveAsync(TransLogs model) { // model.id = SchoolId; // ObjectValidation(model); //TransLogs existed = GetQueryable(x => x.Name.ToLower().Equals(model.Name.ToLower())).FirstOrDefault(); //if (existed != null) // return existed; // throw new ProjectException("The Route already exists."); _ModelRepository.Add(model); await _UnitOfWork.SaveChangesAsync(); return(model); }
public async Task <TransLogs> DeleteAsync(Guid Id) { TransLogs obj = await GetByIdAsync(Id); if (obj == null) { throw new ProjectException("The record does not exist in the system. Thank you"); } // Country.IsDeleted = true; // _ValidationProvider.Validate(attendance); _ModelRepository.Attach(obj, EntityStatus.Modified); await _UnitOfWork.SaveChangesAsync(); return(obj); }
public async Task <TransLogs> UpdateAsync(TransLogs model) { // model.IsUpdated = true; // ObjectValidation(model); var dbobj = await GetByIdAsync(model.Id); if (dbobj == null) { throw new ProjectException("The Record does not exist in the system"); } _ModelRepository.Attach(dbobj, EntityStatus.Modified); await _UnitOfWork.SaveChangesAsync(); return(dbobj); }