public ActionResult Index(Guid id) { Celling c = this.CellingLogic.Get(id); CellingDescription cellingDescription = this.CellingLogic.GetDescription(id); return(View(new KeyValuePair <string, CellingDescription>(c.Title, cellingDescription))); }
private bool IsValidImage(Celling item) { // if I found something if (this.Get(item.Id) != Celling.Empty) { return(false); } return(true); }
public void Add(Celling item) { if (this.IsValidImage(item)) { this.CellingDao.Add(item); } else { throw new InvalidOperationException($"Can't add item with id {item.Id}: logic layer validation failed"); } }
private bool IsValidImage(Celling item) { if (item.Id == default(Guid) || string.IsNullOrWhiteSpace(item.ImageUrl) || string.IsNullOrWhiteSpace(item.Cost) || string.IsNullOrWhiteSpace(item.Title)) { return false; } return true; }
public void Add(Celling item) { if (!this.IsValidImage(item)) { throw new InvalidOperationException($"Can't add celling with id {item.Id}: data layer validation failed"); } using (var sqlConnection = new SqlConnection(Constant.ConnectionString)) { sqlConnection.Query <Image>(CellingDao.InsertCommand, param: new { item.Id, item.ImageUrl, item.Cost, Description = item.Title }); } }
public void Update(Celling item) { this.CellingDao.Update(item); }
public void Update(Celling item) { throw new NotImplementedException(); }