Exemple #1
0
        /// <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);
        }
Exemple #2
0
        // [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());
        }