Exemple #1
0
        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)));
        }
Exemple #2
0
        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;
        }
Exemple #5
0
        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);
 }
Exemple #7
0
 public void Update(Celling item)
 {
     throw new NotImplementedException();
 }