示例#1
0
        public APIResponse UploadUserDetail(UsersDetails usersDetails)
        {
            UsersDetailsModel details  = new UsersDetailsModel();
            APIResponse       response = new APIResponse();

            try
            {
                using (TestEngineEntities testEngineEntities = new TestEngineEntities())
                {
                    UserDetailMaster users = new UserDetailMaster();
                    users.Id           = Guid.NewGuid();
                    users.UserTitle    = usersDetails.UserTitleName;
                    users.CreatedDate  = DateTime.Now;
                    users.ModifiedDate = DateTime.Now;
                    users.IsDeleted    = false;
                    testEngineEntities.UserDetailMasters.Add(users);

                    foreach (var item in usersDetails.UsersDetailsModel)
                    {
                        DefaultRegistation defaultRegistation = new DefaultRegistation();
                        defaultRegistation.ID            = Guid.NewGuid();
                        defaultRegistation.UserDetailId  = users.Id;
                        defaultRegistation.Name          = item.Name;
                        defaultRegistation.Email         = item.Email;
                        defaultRegistation.MobileNumber  = item.MobileNumber;
                        defaultRegistation.Degree        = item.Degree;
                        defaultRegistation.Institution   = item.Institution;
                        defaultRegistation.Major         = item.Major;
                        defaultRegistation.Percentage    = item.Percentage;
                        defaultRegistation.Gender        = item.Gender;
                        defaultRegistation.Address       = item.Address;
                        defaultRegistation.CustomField1  = item.CustomField1;
                        defaultRegistation.CustomField2  = item.CustomField2;
                        defaultRegistation.CustomField3  = item.CustomField3;
                        defaultRegistation.CustomField4  = item.CustomField4;
                        defaultRegistation.CustomField5  = item.CustomField5;
                        defaultRegistation.CustomField6  = item.CustomField6;
                        defaultRegistation.CustomField7  = item.CustomField7;
                        defaultRegistation.CustomField8  = item.CustomField8;
                        defaultRegistation.CustomField9  = item.CustomField9;
                        defaultRegistation.CustomField10 = item.CustomField10;
                        testEngineEntities.DefaultRegistations.Add(defaultRegistation);
                    }
                    testEngineEntities.SaveChanges();
                    response.Result = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(response);
        }
示例#2
0
        public string SaveAdminDetails(AdminDetail adminDetail)
        {
            string result = Failed;

            try
            {
                using (TestEngineEntities TestEngineDBContext = new TestEngineEntities())
                {
                    var admin = TestEngineDBContext.AdminDetails.FirstOrDefault(x => x.ID == adminDetail.ID);
                    if (admin == null)
                    {
                        admin              = new AdminDetail();
                        admin.CreatedDate  = DateTime.Now;
                        admin.Email        = adminDetail.Email;
                        admin.ID           = Guid.NewGuid();
                        admin.Isdeleted    = false;
                        admin.ModifiedDate = DateTime.Now;
                        admin.Password     = adminDetail.Password;
                        admin.PhoneNumber  = adminDetail.PhoneNumber;
                        admin.Role         = adminDetail.Role;
                        admin.Name         = adminDetail.Name;
                        admin.IsSuperAdmin = false;
                        TestEngineDBContext.AdminDetails.Add(admin);
                    }
                    else
                    {
                        admin.Email        = adminDetail.Email;
                        admin.ModifiedDate = DateTime.Now;
                        admin.Password     = adminDetail.Password;
                        admin.PhoneNumber  = adminDetail.PhoneNumber;
                        admin.Role         = adminDetail.Role;
                        admin.UserName     = adminDetail.UserName;
                        admin.Name         = adminDetail.Name;
                    }
                    TestEngineDBContext.SaveChanges();
                    result = Success;
                }
            }
            catch (Exception ex)
            {
            }
            return(result);
        }
示例#3
0
        public string DeleteAdmin(string id)
        {
            string result = Failed;

            try
            {
                Guid adminID = new Guid(id);
                using (TestEngineEntities TestEngineDBContext = new TestEngineEntities())
                {
                    var admin = TestEngineDBContext.AdminDetails.FirstOrDefault(x => x.ID == adminID);
                    if (admin != null)
                    {
                        admin.ModifiedDate = DateTime.Now;
                        admin.Isdeleted    = true;
                        TestEngineDBContext.SaveChanges();
                        result = Success;
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(result);
        }