예제 #1
0
        public ReturnModel companyRegisterpost(addSellermodel details)
        {
            ReturnModel retmodel = new ReturnModel();

            try
            {
                var Data = _dbcontext.companyRegister.FirstOrDefault(x => x.registercompanyEmail.ToLower().Equals(details.registercompanyEmail.ToLower()));
                if (Data != null)
                {
                    retmodel.message    = "Super Admin Already Exists";
                    retmodel.statusCode = HttpStatusCode.BadRequest;
                }
                else
                {
                    companyRegister registercompany = new companyRegister
                    {
                        registercompnyName     = details.registercompnyName,
                        registercompanyEmail   = details.registercompanyEmail,
                        registercompanyMNo     = details.registercompanyMNo,
                        registerOwnername      = details.registerOwnername,
                        registercompanyTitle   = details.registercompanyTitle,
                        registercompanyAddress = details.registercompanyAddress,
                        IsActive        = true,
                        IsDeleted       = false,
                        IsUpdated       = false,
                        CreateDateTime  = DateTime.UtcNow,
                        DeletedDateTime = null,
                        UpdatedDateTime = null
                    };
                    _dbcontext.companyRegister.Add(registercompany);
                    var isSaved = _dbcontext.SaveChanges();
                    if (isSaved > 0)
                    {
                        retmodel.message    = "Successfully Added New commpany Admin";
                        retmodel.statusCode = HttpStatusCode.OK;
                    }
                    else
                    {
                        retmodel.message    = "Can't add due to technical error";
                        retmodel.statusCode = HttpStatusCode.InternalServerError;
                    }
                }
            }
            catch (Exception ex)
            {
                retmodel.message    = ex.Message.ToString();
                retmodel.statusCode = HttpStatusCode.InternalServerError;
            }
            return(retmodel);
        }
예제 #2
0
        public ReturnModel updatecompanyRegisterdetails(updateSellermodel updatecompany)
        {
            ReturnModel retModel = new ReturnModel();
            var         Data     = _dbcontext.companyRegister.FirstOrDefault(x => x.registercompanyEmail.ToLower().Equals(updatecompany.registercompanyEmail.ToLower()));

            if (Data != null)
            {
                Data.registercompnyName     = updatecompany.registercompnyName;
                Data.registercompanyEmail   = updatecompany.registercompanyEmail;
                Data.registercompanyMNo     = updatecompany.registercompanyMNo;
                Data.registerOwnername      = updatecompany.registerOwnername;
                Data.registercompanyTitle   = updatecompany.registercompanyTitle;
                Data.registercompanyAddress = updatecompany.registercompanyAddress;

                Data.IsUpdated       = true;
                Data.UpdatedDateTime = DateTime.UtcNow;
                _dbcontext.companyRegister.Update(Data);
                var Isupdated = _dbcontext.SaveChanges();
                if (Isupdated == 1)
                {
                    companyRegister registercompany = new companyRegister
                    {
                        registercompnyName     = updatecompany.registercompnyName,
                        registercompanyEmail   = updatecompany.registercompanyEmail,
                        registercompanyMNo     = updatecompany.registercompanyMNo,
                        registerOwnername      = updatecompany.registerOwnername,
                        registercompanyTitle   = updatecompany.registercompanyTitle,
                        registercompanyAddress = updatecompany.registercompanyAddress
                    };
                    retModel.message    = "Successfully update Super Admin";
                    retModel.statusCode = HttpStatusCode.OK;
                }
                else
                {
                    retModel.message    = "can't update Super Admin";
                    retModel.statusCode = HttpStatusCode.OK;
                }
            }
            return(retModel);
        }