public HttpResponseMessage UpdateUserType(String id, Entities.MstUserType objUserType) { try { var userType = from d in db.MstUserTypes where d.Id == Convert.ToInt32(id) select d; if (userType.Any()) { var updateUserType = userType.FirstOrDefault(); updateUserType.UserType = objUserType.UserType; db.SubmitChanges(); return(Request.CreateResponse(HttpStatusCode.OK)); } else { return(Request.CreateResponse(HttpStatusCode.NotFound)); } } catch (Exception e) { Debug.WriteLine(e); return(Request.CreateResponse(HttpStatusCode.InternalServerError)); } }
public HttpResponseMessage AddUserType(Entities.MstUserType objUserType) { try { Data.MstUserType newUserType = new Data.MstUserType { UserType = objUserType.UserType }; db.MstUserTypes.InsertOnSubmit(newUserType); db.SubmitChanges(); return(Request.CreateResponse(HttpStatusCode.OK)); } catch (Exception e) { Debug.WriteLine(e); return(Request.CreateResponse(HttpStatusCode.InternalServerError)); } }