Exemple #1
0
        public ActionResult GetClosetGarmentDetails(int garmentSelected)
        {
            ClosetGarment garment = closetRepository.GetClosetGarment(garmentSelected);

            if (garment.Details == null)
            {
                return(Json(new
                {
                    PurchasedAt = string.Empty,
                    PurchasedOn = string.Empty,
                    MadeBy = string.Empty,
                    MadeOf = string.Empty,
                    IsTailored = string.Empty,
                    CareConditions = string.Empty,
                    StoreConditions = string.Empty
                }));
            }

            return(Json(new
            {
                PurchasedAt = garment.Details.PurchasedAt,
                PurchasedOn = garment.Details.PurchasedOn.ToShortDateString(),
                MadeBy = garment.Details.MadeBy,
                MadeOf = garment.Details.MadeOf,
                IsTailored = garment.Details.IsTailored.ToString(),
                CareConditions = garment.Details.CareConditions,
                StoreConditions = garment.Details.StoreConditions
            }));
        }
        public ActionResult SaveDetails(WebGarmentDetails detail)
        {
            ClosetGarment garment = closetRepository.GetClosetGarment(detail.ClosetGarmentId);

            if (garment.Details == null)
            {
                garment.Details = new GarmentDetails();
            }

            garment.Details.CareConditions = detail.CareConditions;
            garment.Details.IsTailored     = false;
            if (detail.IsTailored == "True")
            {
                garment.Details.IsTailored = true;
            }
            garment.Details.MadeBy      = detail.MadeBy;
            garment.Details.MadeOf      = detail.MadeOf;
            garment.Details.PurchasedAt = detail.PurchasedAt;
            if (StringHelper.IsDateTime(detail.PurchasedOn))
            {
                IFormatProvider formatProvider = new CultureInfo("en-US");
                garment.Details.PurchasedOn = Convert.ToDateTime(detail.PurchasedOn, formatProvider);
            }
            garment.Details.StoreConditions = detail.StoreConditions;

            closetRepository.SaveClosetGarment(garment);

            return(Json(new { Success = true }));
        }
Exemple #3
0
        public ActionResult RemoveGarmentFromCloset(int garmentSelected)
        {
            MembershipUser mu      = Membership.GetUser();
            RegisteredUser user    = registeredUserRepository.GetByMembershipId(Convert.ToInt32(mu.ProviderUserKey));
            Closet         closet  = user.Closet;
            ClosetGarment  garment = closetRepository.GetClosetGarment(garmentSelected);

            closet.RemoveGarment(garment);
            closetRepository.SaveOrUpdate(closet);
            closetRepository.RemoveGarmentFromCloset(garment.Id, closet.Id);

            return(Json(new { Success = true }));
        }
Exemple #4
0
        public ActionResult SaveDetails(WebGarmentDetails detail)
        {
            ClosetGarment garment = closetRepository.GetClosetGarment(detail.ClosetGarmentId);

            if (garment.Details == null)
            {
                garment.Details = new GarmentDetails();
            }
            garment.Details.CareConditions = detail.CareConditions;
            garment.Details.IsTailored     = false;
            if (detail.IsTailored == "True")
            {
                garment.Details.IsTailored = true;
            }
            garment.Details.MadeBy          = detail.MadeBy;
            garment.Details.MadeOf          = detail.MadeOf;
            garment.Details.PurchasedAt     = detail.PurchasedAt;
            garment.Details.PurchasedOn     = Convert.ToDateTime(detail.PurchasedOn);
            garment.Details.StoreConditions = detail.StoreConditions;
            closetRepository.SaveOrUpdateGeneric(garment);

            return(Json(new { Success = true }));
        }
Exemple #5
0
 public ClosetGarment SaveClosetGarment(ClosetGarment o)
 {
     NHibernateSession.Current.SaveOrUpdate(o);
     return(o);
 }