public List <API.LABURNUM.COM.Subject> GetSubjectByAdvanceSearch(DTO.LABURNUM.COM.SubjectModel model) { IQueryable <API.LABURNUM.COM.Subject> iQuery = null; if (model.SubjectId > 0) { iQuery = this._laburnum.Subjects.Where(x => x.SubjectId == model.SubjectId && x.IsActive == true); } if (iQuery != null) { if (model.SubjectName != null) { iQuery = iQuery.Where(x => x.SubjectName.Trim().ToLower().Equals(model.SubjectName.Trim().ToLower()) && x.IsActive == true); } } else { if (model.SubjectName != null) { iQuery = this._laburnum.Subjects.Where(x => x.SubjectName.Trim().ToLower().Equals(model.SubjectName.Trim().ToLower()) && x.IsActive == true); } } List <API.LABURNUM.COM.Subject> dbSubjectes = iQuery.ToList(); return(dbSubjectes); }
public void UpdateStatus(DTO.LABURNUM.COM.SubjectModel model) { if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password)) { new FrontEndApi.SubjectApi().UpdateIsActive(model); } }
public dynamic SearchAllActiveSubjects(DTO.LABURNUM.COM.SubjectModel model) { if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password)) { return(GetApiResponseModel("Successfully Performed.", true, new SubjectHelper(new FrontEndApi.SubjectApi().GetActiveSubject()).Map())); } else { return(GetApiResponseModel("Api Access User Name or Password Invalid.", false, null)); } }
public List <DTO.LABURNUM.COM.SubjectModel> SearchSubjectByAdvanceSearch(DTO.LABURNUM.COM.SubjectModel model) { if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password)) { return(new SubjectHelper(new FrontEndApi.SubjectApi().GetSubjectByAdvanceSearch(model)).Map()); } else { return(null); } }
public long Add(DTO.LABURNUM.COM.SubjectModel model) { if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password)) { return(new FrontEndApi.SubjectApi().Add(model)); } else { return(-1); } }
private long AddSubject(DTO.LABURNUM.COM.SubjectModel model) { API.LABURNUM.COM.Subject apiSubject = new Subject() { SubjectName = model.SubjectName, CreatedOn = new Component.Utility().GetISTDateTime(), IsActive = true }; this._laburnum.Subjects.Add(apiSubject); this._laburnum.SaveChanges(); return(apiSubject.SubjectId); }
private DTO.LABURNUM.COM.SubjectModel MapCore(API.LABURNUM.COM.Subject apiSubject) { DTO.LABURNUM.COM.SubjectModel dtoSubject = new DTO.LABURNUM.COM.SubjectModel() { SubjectId = apiSubject.SubjectId, SubjectName = apiSubject.SubjectName, CreatedOn = apiSubject.CreatedOn, IsActive = apiSubject.IsActive, LastUpdated = apiSubject.LastUpdated }; return(dtoSubject); }
public void UpdateIsActive(DTO.LABURNUM.COM.SubjectModel model) { model.SubjectId.TryValidate(); IQueryable <API.LABURNUM.COM.Subject> iQuery = this._laburnum.Subjects.Where(x => x.SubjectId == model.SubjectId && x.IsActive == true); List <API.LABURNUM.COM.Subject> dbSubjectes = iQuery.ToList(); if (dbSubjectes.Count == 0) { throw new Exception(API.LABURNUM.COM.Component.Constants.ERRORMESSAGES.NO_RECORD_FOUND); } if (dbSubjectes.Count > 1) { throw new Exception(API.LABURNUM.COM.Component.Constants.ERRORMESSAGES.MORE_THAN_ONE_RECORDFOUND); } dbSubjectes[0].IsActive = model.IsActive; dbSubjectes[0].LastUpdated = new Component.Utility().GetISTDateTime(); this._laburnum.SaveChanges(); }
public long Add(DTO.LABURNUM.COM.SubjectModel model) { return(AddValidation(model)); }
private long AddValidation(DTO.LABURNUM.COM.SubjectModel model) { model.SubjectName.TryValidate(); return(AddSubject(model)); }