public string PutUserServiceDetails(int id, UserServiceDetails r)
 {
     try
     {
         User_Service_Details us = new User_Service_Details();
         var u = (from user in es.User_Service_Details
                  where user.User_Id == id
                  select user).SingleOrDefault();
         if (u == null)
         {
             return("Id Invalid");
         }
         else
         {
             u.Service_Category_ID = r.Service_Category_ID;
             u.User_Name           = r.User_Name;
             u.User_Address        = r.User_Address;
             u.User_Contact        = r.User_Contact;
             u.User_Availavility   = r.User_Availability;
             u.User_Rate           = r.User_Rate;
             var res = es.SaveChanges();
             if (res > 0)
             {
                 return("data Inserted");
             }
             return("Error In Inserting Data");
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#2
0
        public bool PostUserService(UserServiceDetails u)
        {
            try
            {
                User_Service_Details a = new User_Service_Details();

                a.Service_Category_ID = u.Service_Category_ID;
                a.User_Name           = u.User_Name;
                a.User_Address        = u.User_Address;
                a.User_Contact        = u.User_Contact;
                a.User_Availavility   = u.User_Availability;
                a.User_Rate           = u.User_Rate;
                es.User_Service_Details.Add(a);
                var res = es.SaveChanges();
                if (res > 0)
                {
                    return(true);
                }
                return(false);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }