Exemplo n.º 1
0
 private void AddOrGetLabelId(SongTagFile songTag, Song song)
 {
     if (songTag.Label != null)
     {
         var label = LabelRepository.Get(x => x.Name == songTag.Label).FirstOrDefault();
         if (label == null)
         {
             song.Label = new Label()
             {
                 Name = songTag.Label
             };
             LabelRepository.Insert(song.Label);
             this.Save();
         }
         else
         {
             song.LabelId = label.Id;
         }
     }
 }
Exemplo n.º 2
0
        public ActionResult Detail(int?id, Labels model)
        {
            LabelRepository objlab = new LabelRepository(SessionCustom);

            objlab.Entity = model.LabelCustom;
            SetLabel();
            if (id != null)
            {
                objlab.Entity.LabelId = id;
                objlab.Update();
                this.InsertAudit("Update", this.Module.Name + " -> " + objlab.Entity.Name);
            }
            else
            {
                objlab.Entity.LanguageId = CurrentLanguage.LanguageId;
                objlab.Insert();
                this.InsertAudit("Insert", this.Module.Name + " -> " + objlab.Entity.Name);
            }

            return(this.RedirectToAction("Index", "Label"));
        }