// POST: api/BusinessCustomer
 public IHttpActionResult Post([FromBody] BusinessCustomerViewMdoel model)
 {
     try
     {
         if (model != null)
         {
             var businessCustomer = new tblBusinessCustomer()
             {
                 FirstName         = model.FirstName,
                 LastName          = model.LastName,
                 ProfilePicture    = model.ProfilePicture,
                 Email             = model.Email,
                 StdCode           = model.StdCode,
                 PhoneNumber       = model.PhoneNumber,
                 Add1              = model.Add1,
                 Add2              = model.Add2,
                 City              = model.City,
                 State             = model.State,
                 Zip               = model.Zip,
                 LoginId           = model.LoginId,
                 Password          = model.Password,
                 IsActive          = model.IsActive,
                 Created           = model.Created,
                 TimezoneId        = model.TimezoneId,
                 ServiceLocationId = model.ServiceLocationId
             };
             _db.tblBusinessCustomers.Add(businessCustomer);
             var response = _db.SaveChanges();
             if (response > 0)
             {
                 return(Ok(new { status = true, data = businessCustomer }));
             }
             else
             {
                 return(Ok(new { status = false, data = "There was a problem." }));
             }
         }
         else
         {
             return(Ok(new { status = false, data = "There was a problem." }));
         }
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message.ToString()));
     }
 }
        public ResponseViewModel <BusinessCustomerViewMdoel> Register(BusinessCustomerViewMdoel model)
        {
            var data     = new ResponseViewModel <BusinessCustomerViewMdoel>();
            var hasEmail = _db.tblBusinessCustomers.Any(d => d.Email.ToLower() == model.Email.ToLower() && d.ServiceLocationId == model.ServiceLocationId);

            if (hasEmail)
            {
                data.Status  = false;
                data.Message = "This business email has been taken. Please try another email id.";
            }
            else
            {
                var businessCustomer = new tblBusinessCustomer()
                {
                    FirstName         = model.FirstName,
                    LastName          = model.LastName,
                    Password          = Security.Encrypt(model.Password, true),
                    Email             = model.Email,
                    StdCode           = model.StdCode,
                    IsActive          = model.IsActive,
                    PhoneNumber       = model.PhoneNumber,
                    Add1              = model.Add1,
                    Add2              = model.Add2,
                    City              = model.City,
                    ProfilePicture    = model.ProfilePicture,
                    State             = model.State,
                    Zip               = model.Zip,
                    Created           = DateTime.Now.ToUniversalTime(),
                    ServiceLocationId = model.ServiceLocationId
                };
                _db.tblBusinessCustomers.Add(businessCustomer);
                var response = _db.SaveChanges();
                data.Message = response > 0 ? "success" : "failed";
                data.Status  = response > 0 ? true : false;
                data.Data    = model;
            }
            return(data);
        }