Esempio n. 1
0
        public async Task <CommonResponce> UpdateSubject(SubjectMasterVM oSubjectToUpdate)
        {
            CommonResponce result = new CommonResponce {
                Stat = false, StatusMsg = ""
            };
            bool isValid = false;

            try
            {
                var oSubject = await _DBSubjectRepository.GetSubjectBySubjectId(oSubjectToUpdate.Id).ConfigureAwait(false);

                if (oSubject != null)
                {
                    oSubject.Name = oSubjectToUpdate.Name;
                    _commonRepository.Update(oSubject);
                    result.Stat      = true;
                    result.StatusMsg = "Subject information updated successfully";
                }
                else      // subject not found
                {
                    result.StatusMsg = "Not a valid Subject";
                }
            }
            catch { result.Stat = isValid; result.StatusMsg = "Failed to update subject information"; }
            return(result);
        }
Esempio n. 2
0
        public async Task <IActionResult> AddSubject()
        {
            CreateBreadCrumb(new[] { new { Name = "Home", ActionUrl = "#" },
                                     new { Name = "Subject", ActionUrl = "/Subject/AddSubject" } });
            BaseViewModel VModel     = null;
            var           TempVModel = new SubjectMasterVM();

            VModel = await GetViewModel(TempVModel);

            //}
            //*****get user avtar************

            /*
             * string UsrImgPath = string.Format("{0}\\{1}.{2}", Path.Combine(GetBaseService().GetAppRootPath(), "AppFileRepo\\UserAvatar"), CurrentUserInfo.UserID, "jpg");
             * if (System.IO.File.Exists(UsrImgPath))
             * {
             *  UsrImgPath = string.Format("~/AppFileRepo/UserAvatar/{0}.{1}", CurrentUserInfo.UserID, "jpg");
             * }
             * else
             * {
             *  if (CurrentUserInfo.UserGender.Equals("M"))
             *      UsrImgPath = "~/img/avatar5.png";
             *  else
             *      UsrImgPath = "~/img/avatar3.png";
             * }
             */
            //*******************************
            return(View("~/Views/Master/AddSubject.cshtml", VModel));
        }
Esempio n. 3
0
        public async Task <JsonResult> AddSubject(SubjectMasterVM model)
        {
            if (ModelState.IsValid)
            {
                var result = await _SubjectService.InsertSubject(model);

                //await GetBaseService().AddActivity(ActivityType.Update, model.UserID, model.UserName, "User Profile", "Updated user profile");
                if (result.Stat == true)
                {
                    return(Json(new { stat = true, msg = "Subject Inserted", rtnUrl = "/Subject/Subjects" }));
                }
                else
                {
                    return(Json(new { stat = false, msg = result.StatusMsg }));
                }
            }
            else
            {
                return(Json(new { stat = false, msg = "Invalid Subject" }));
            }
        }
Esempio n. 4
0
        public async Task <CommonResponce> InsertSubject(SubjectMasterVM SubjectToInsert)
        {
            CommonResponce result = new CommonResponce {
                Stat = false, StatusMsg = ""
            };
            bool isValid = false;

            try
            {
                Tblmsubject oSubject = new Tblmsubject
                {
                    Name = SubjectToInsert.Name,
                };
                //isValid = await _commonRepository.Insert(_mapper.Map<Tblmstudent>(StudentToInsert));
                isValid = await _commonRepository.Insert(oSubject);

                result.Stat      = isValid;
                result.StatusMsg = "Subject added successfully";
            }
            catch (Exception ex) { result.Stat = isValid; result.StatusMsg = "Failed to add new Subject"; }
            return(result);
        }