コード例 #1
0
 public IHttpActionResult UpdateUser([FromBody] UserMaster user)
 {
     try
     {
         var obj = _genericRepository.GetById(user.Id);
         obj.Name         = user.Name;
         obj.Email        = user.Email;
         obj.Address      = user.Address;
         obj.Designation  = user.Designation;
         obj.Organization = user.Organization;
         obj.MobileNo     = user.MobileNo;
         obj.About        = user.About;
         obj.Skill        = user.Skill;
         obj.RatePerhours = user.RatePerhours;
         _genericRepository.Update(obj);
         if (user != null)
         {
             var res = new ApiResponse()
             {
                 status = HttpStatusCode.OK.ToString(),
                 code   = (int)HttpStatusCode.OK,
                 result = user
             };
             return(Ok(res));
         }
         else
         {
             return(BadRequest());
         }
     }
     catch (System.Exception ex)
     {
         throw ex;
     }
 }
コード例 #2
0
        public IHttpActionResult Delete(int id)
        {
            var res = new ApiResponse();
            var dom = _banner.GetById(id);

            if (dom != null)
            {
                _banner.Delete(dom);
                res = new ApiResponse()
                {
                    status = HttpStatusCode.OK.ToString(),
                    code   = (int)HttpStatusCode.OK,
                    result = null
                };
            }
            else
            {
                res = new ApiResponse()
                {
                    status = HttpStatusCode.NotFound.ToString(),
                    code   = (int)HttpStatusCode.NotFound,
                    result = "image Not found"
                };
            }
            return(Ok(res));
        }
コード例 #3
0
        public IHttpActionResult get(int id)
        {
            //var lst = _admissionForm.List();
            var dom = new StudentAdmissionFormResponse();
            var x   = _admissionForm.GetById(id);

            dom = new StudentAdmissionFormResponse()
            {
                registrationNumber = x.RegistrationNumber,
                submittedStatus    = string.IsNullOrEmpty(x.SubmittedStatus) ? "" : "Submitted",
                id                = x.Id,
                address           = x.Address,
                candidatename     = x.CandidateName,
                city              = x.City,
                coursetype        = x.CourseType,
                email             = x.Email,
                fathername        = x.FatherName,
                qualificationList = _studentMapping.Get(d => d.StudentAdmissionID == id).ToList().ConvertAll(xy => new QualificationResp
                {
                    boards        = xy.Boards,
                    sclass        = xy.Class,
                    subjects      = xy.Subjects,
                    yearofpassing = xy.YearOfPassing,
                }).ToList(),
                mobile     = x.Mobile,
                mothername = x.MotherName,
                state      = x.State
            };

            if (dom != null)
            {
                var res = new ApiResponse()
                {
                    status = HttpStatusCode.OK.ToString(),
                    code   = (int)HttpStatusCode.OK,
                    result = dom,
                    pages  = 0
                };
                return(Ok(res));
            }
            else
            {
                return(BadRequest());
            }
        }
コード例 #4
0
        public async Task <TEntity> GetById(int id)
        {
            return(await _generic.GetById(id));

            // throw new NotImplementedException();
        }
コード例 #5
0
 public ActionResult Edit(int id = 0)
 {
     return(View(db.GetById(id)));
 }
コード例 #6
0
 public TModel GetById(int id)
 {
     return(_service.GetById(id));
 }