/// <summary> /// Insert Registration /// </summary> /// <returns></returns> /// public async Task <Apiuserdetail> InsRegistration(Apiuserdetail Values) { Values.Password = EncryptString(Values.Password); Values.Status = 1; Values.Ideleted = 0; Values.CreatedDate = DateTime.Now; await db.Apiuserdetails.AddAsync(Values); await db.SaveChangesAsync(); return(Values); }
// [Authorize] public async Task <IActionResult> PostApiuserdetails(Apiuserdetail apiuserdetails) { APIUserProfilesContext DB = new APIUserProfilesContext(); UserDetailsCM objmodel = new UserDetailsCM(); if (ModelState.IsValid) { try { int usernameexists = await obj.CheckByUserName(apiuserdetails.UserName); if (usernameexists == 0) { var ud = await obj.InsRegistration(apiuserdetails); objmodel.UserDetails.UserID = ud.UserId; if (ud.UserId > 0) { return(Ok(objmodel)); } else { return(NotFound()); } } else { return(BadRequest("UserName Already Exists")); } } catch (Exception) { return(BadRequest()); } } return(BadRequest()); }