Exemple #1
0
        public Response <ArtistDto> Create(ArtistDto newObject)
        {
            try
            {
                if (newObject != null && ValidateName(newObject))
                {
                    Response <int> dataResponse = dal.Insert(newObject);
                    newObject.Id = dataResponse.Data;

                    return(new Response <ArtistDto>(dataResponse.Status, dataResponse.Message, newObject));
                }
                return(new Response <ArtistDto>(false, "Artist Null or Artist Name isn't valid.", null));
            }
            catch (Exception e)
            {
                if (e.InnerException == null)
                {
                    return(new Response <ArtistDto>(false, "Somethig was wrong. Exception: " + e.Message, null));
                }
                else
                {
                    return(new Response <ArtistDto>(false, "Somethig was wrong. Exception: " + e.InnerException.InnerException.Message, null));
                }
            }
        }