コード例 #1
0
        public HttpResponseMessage updateadminDetail(Admin admin)
        {
            try
            {
                return Request.CreateResponse(HttpStatusCode.OK, _repo.UpdateAdmin(admin));
            }
            catch (Exception)
            {

                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }
        }
コード例 #2
0
        public Admin AddAdmin(Admin Adminobj)
        {
            try
            {
                Adminobj.CreatedDate = DateTime.Now;
                Adminobj.ModifiedDate = DateTime.Now;
                _context.Admins.Add(Adminobj);
                SaveContext();
                return Adminobj;
            }
            catch (Exception)
            {

                throw;
            }
        }
コード例 #3
0
        public bool UpdateAdmin(Admin AdminObj)
        {
            try
            {
                Admin admin = _context.Admins.Where(x => x.AdminId == AdminObj.AdminId).FirstOrDefault();
                if (admin != null)
                {
                    admin.Address = AdminObj.Address;
                    admin.City = AdminObj.City;
                    admin.Email = AdminObj.Email;
                    admin.FirstName = AdminObj.FirstName;
                    admin.MobileNumber = AdminObj.MobileNumber;
                    admin.Pincode = AdminObj.Pincode;
                    admin.sex = AdminObj.sex;
                    _context.Entry(admin).State = System.Data.Entity.EntityState.Modified;
                    SaveContext();
                    return true;
                }
                return false;
            }
            catch (Exception)
            {

                throw;
            }
        }