コード例 #1
0
        public ActionResult UpdateAssociate(Associate associate)
        {
            Associate objA;

            associate.BusinessID = base.Business.BusinessID;


            if (associate.AssociateID > 0)
            {
                objA = new Associate(associate.AssociateID);

                objA.FirstName       = associate.FirstName;
                objA.LastName        = associate.LastName;
                objA.Address         = associate.Address;
                objA.City            = associate.City;
                objA.State           = associate.State;
                objA.Zip             = associate.Zip;
                objA.Phone           = associate.Phone;
                objA.AltPhone        = associate.AltPhone;
                objA.Email           = associate.Email;
                objA.UserName        = associate.UserName;
                objA.Password        = associate.Password;
                objA.Active          = associate.Active;
                objA.BackgroundColor = associate.BackgroundColor;
                objA.TextColor       = associate.TextColor;

                if (objA.Update())
                {
                    if (objA.AssociateID == base.Associate.AssociateID)
                    {
                        Session["Associate"] = null;
                        Session["Associate"] = objA;
                    }
                    return(Json("1"));
                }
                else
                {
                    return(Json("0"));
                }
            }
            else
            {
                associate.DateCreated = DateTime.Now;

                if (associate.Update())
                {
                    return(Json("1"));
                }
                else
                {
                    return(Json("0"));
                }
            }
        }