private List <Tracker> BuildTracker() { var trackerList = new List <Tracker>(); trackerList.Add(_trackerPivotService.AddTracker(TrackerConstants.CURRENT_WEIGHT, CurrentWeightValue.ToString())); trackerList.Add(_trackerPivotService.AddTracker(TrackerConstants.CURRENT_WEIGHT_UI, CurrentWeightValue.ToString())); trackerList.Add(_trackerPivotService.AddTracker(TrackerConstants.WEIGHT_VOLUME_TYPE, App.Configuration.AppConfig.DefaultWeightVolume)); if (GoalAchieved) { trackerList.Add(_trackerPivotService.AddTracker(TrackerConstants.TSHIRT_SIZE, TShirtSize.Trim())); trackerList.Add(_trackerPivotService.AddTracker(TrackerConstants.FRONT_IMAGE, ImageFront.Trim())); trackerList.Add(_trackerPivotService.AddTracker(TrackerConstants.SIDE_IMAGE, ImageSide.Trim())); trackerList.Add(_trackerPivotService.AddTracker(TrackerConstants.ABOUT_JOURNEY, AboutYourJourney.Trim())); } return(trackerList); }
public bool DeleteUserTSize(int id, AppContext db) { TShirtSize size = db.TShirtSizes.Find(id); db.TShirtSizes.Remove(size); db.SaveChanges(); return(true); }
public bool EditUserTSize(TShirtSize model, AppContext db) { db.Entry(model).State = EntityState.Modified; model.DateLastUpdated = DateTime.Now; model.UserLastUpdated = System.Web.HttpContext.Current.User.Identity.Name; db.SaveChanges(); return(true); }
public ActionResult Edit([Bind(Include = "Id,TShirtSizeId,Size,Archived,DateLastUpdated,UserLastUpdated,DateCreated,UserCreated")] TShirtSize tShirtSize) { if (ModelState.IsValid) { service.EditUserTSize(tShirtSize, db); return(RedirectToAction("Index")); } return(View(tShirtSize)); }
public bool CreateUserTSize(TShirtSize model, AppContext db) { model.Archived = false; model.DateCreated = DateTime.Now; model.DateLastUpdated = DateTime.Now; model.UserCreated = System.Web.HttpContext.Current.User.Identity.Name; db.TShirtSizes.Add(model); db.SaveChanges(); return(true); }
//============================= Methods ===================================== public void DisplayTShirt() { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(); Console.WriteLine("\tThe T-shirt that you have selected has :"); Console.WriteLine(); Console.WriteLine($"\tColor : {TShirtColor.ToString()}"); Console.WriteLine($"\tSize : {TShirtSize.ToString()}"); Console.WriteLine($"\tFabric : {TShirtFabric.ToString()}"); Console.WriteLine(); Console.WriteLine($"\tPrice : {TShirtPrice}"); Console.ForegroundColor = ConsoleColor.White; }
// GET: TShirtSizes/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TShirtSize tShirtSize = db.TShirtSizes.Find(id); if (tShirtSize == null) { return(HttpNotFound()); } return(View(tShirtSize)); }
private async Task <List <Tracker> > BuildTracker() { var trackerList = new List <Tracker>(); await Task.Run(async() => { trackerList.Add(await trackerService.AddTracker(TrackerConstants.CURRENT_WEIGHT, CurrentWeightValue.ToString())); if (GoalAchieved) { trackerList.Add(await trackerService.AddTracker(TrackerConstants.TSHIRT_SIZE, TShirtSize.Trim())); trackerList.Add(await trackerService.AddTracker(TrackerConstants.FRONT_IMAGE, ImageFront.Trim())); trackerList.Add(await trackerService.AddTracker(TrackerConstants.SIDE_IMAGE, ImageSide.Trim())); trackerList.Add(await trackerService.AddTracker(TrackerConstants.ABOUT_JOURNEY, AboutYourJourney.Trim())); } }); return(trackerList); }
private async Task <bool> Validate() { var validationErrors = new ValidationErrors(); await Task.Run(() => { // Current Weight if (CurrentWeightValue == 0) { validationErrors.Add( string.Format(TextResources.Required_IsMandatory, TextResources.WeightLossGoal)); } else if (CurrentWeightValue < App.Configuration.AppConfig.MINIMUM_WEIGHT_LOSE) { validationErrors.Add(string.Format(TextResources.Validation_MustBeMoreThan, TextResources.WeightLossGoal, App.Configuration.AppConfig.MINIMUM_WEIGHT_LOSE)); } if (GoalAchieved) { // Front Photo if (ImageFront == null || ImageFront.Trim().Length == 0 || ImageFront == ImageDefault) { validationErrors.Add(string.Format(TextResources.Required_MustBeSelected, TextResources.FrontPhoto)); } // Side Photo if (ImageSide == null || ImageSide.Trim().Length == 0 || ImageSide == ImageDefault) { validationErrors.Add(string.Format(TextResources.Required_MustBeSelected, TextResources.SidePhoto)); } //Gender if (IsGenderRequired && !IsGenderSelected) { validationErrors.Add(string.Format(TextResources.Required_MustBeSelected, TextResources.Gender)); } // T-Shirt Size if (TShirtSize == null || TShirtSize.Trim().Length == 0) { validationErrors.Add(string.Format(TextResources.Required_MustBeSelected, TextResources.TShirtSize)); } // Why you want to join if (AboutYourJourney == null || AboutYourJourney.Trim().Length == 0) { validationErrors.Add(string.Format(TextResources.Required_IsMandatory, TextResources.AboutYourJourney)); } } }); if (validationErrors.Count() > 0) { SetActivityResource(showError: true, errorMessage: validationErrors.Count() > 2 ? TextResources.PleaseReviewAllInputsAreMandatory : validationErrors.Show("\n")); } return(validationErrors.Count() == 0); }
public TShirt(TShirtSize size,TShirtColor color) { this.size = size; this.color = color; }
public TShirt() { this.size = TShirtSize.M; this.color = TShirtColor.Red; }