コード例 #1
0
ファイル: SubjectApi.cs プロジェクト: nishantchau/LAB
        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);
        }
コード例 #2
0
 public void UpdateStatus(DTO.LABURNUM.COM.SubjectModel model)
 {
     if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password))
     {
         new FrontEndApi.SubjectApi().UpdateIsActive(model);
     }
 }
コード例 #3
0
ファイル: MAPPController.cs プロジェクト: nishantchau/LAB
 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));
     }
 }
コード例 #4
0
 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);
     }
 }
コード例 #5
0
 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);
     }
 }
コード例 #6
0
ファイル: SubjectApi.cs プロジェクト: nishantchau/LAB
 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);
 }
コード例 #7
0
ファイル: SubjectHelper.cs プロジェクト: nishantchau/LAB
 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);
 }
コード例 #8
0
ファイル: SubjectApi.cs プロジェクト: nishantchau/LAB
        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();
        }
コード例 #9
0
ファイル: SubjectApi.cs プロジェクト: nishantchau/LAB
 public long Add(DTO.LABURNUM.COM.SubjectModel model)
 {
     return(AddValidation(model));
 }
コード例 #10
0
ファイル: SubjectApi.cs プロジェクト: nishantchau/LAB
 private long AddValidation(DTO.LABURNUM.COM.SubjectModel model)
 {
     model.SubjectName.TryValidate();
     return(AddSubject(model));
 }