示例#1
0
        /// <summary>
        /// Get zone Records with name in parameter asynchronously
        /// </summary>
        /// <param name="uuid">The uuid of the zone</param>
        /// <param name="name">Name of Records</param>
        /// <returns>an error code and the json response</returns>
        public async Task <RecordListResponse> GetNamedRecordsAsync(string uuid, string name)
        {
            ApiResponse resp = await _client.GetNamedRecordsAsync(uuid, name);

            RecordListResponse retour = new RecordListResponse();

            retour.Load(resp);
            return(retour);
        }
        /// <summary>
        /// Get domain Records asynchronously
        /// </summary>
        /// <param name="fqdn">The fqdn of the domain</param>
        /// <returns>an error code and the json response</returns>
        public async Task <RecordListResponse> GetAllRecordsAsync(string fqdn)
        {
            ApiResponse resp = await _client.GetAllRecordsAsync(fqdn);

            RecordListResponse retour = new RecordListResponse();

            retour.Load(resp);
            return(retour);
        }
示例#3
0
        public bool GetRecordList(ViewModel.UserAccountView UserAccountView, ViewModel.Presenter Presenter)
        {
            FhirApi          FhirApi          = new FhirApi(FhirGatewayEndpoint);
            ApiRequestHeader ApiRequestHeader = new ApiRequestHeader(UserAccountView.AccessToken, this.ApplicationStore.App_id, this.ApplicationStore.App_Version);

            FhirApi.ApiRequestHeader = ApiRequestHeader;

            RecordListResponse RecordListResponse = FhirApi.GetRecordList();

            if (RecordListResponse.StatusCode == System.Net.HttpStatusCode.OK)
            {
                if (RecordListResponse.Format == FhirApi.FhirFormat.Xml)
                {
                    Presenter.TextEditorViewModel.FormatType = Extensions.AvalonEditSyntaxTypes.Xml;
                }
                else if (RecordListResponse.Format == FhirApi.FhirFormat.Json)
                {
                    Presenter.TextEditorViewModel.FormatType = Extensions.AvalonEditSyntaxTypes.Json;
                }
                else
                {
                    Presenter.TextEditorViewModel.FormatType = Extensions.AvalonEditSyntaxTypes.None;
                }
                Presenter.TextEditorViewModel.Text = RecordListResponse.Body;
                Presenter.CurrentUserAccount.UserAccountRecordList = new System.Collections.ObjectModel.ObservableCollection <ViewModel.UserAccountRecord>();
                foreach (var Person in RecordListResponse.ApiRelatedPersonList)
                {
                    var RecordItem = new ViewModel.UserAccountRecord();
                    RecordItem.Family = Person.Family;
                    RecordItem.Given  = Person.Given;
                    RecordItem.Ihi    = Person.Ihi;
                    RecordItem.RelationshipTypeDescription = Person.RelationshipDescription;
                    Presenter.CurrentUserAccount.UserAccountRecordList.Add(RecordItem);
                }
                if (Presenter.CurrentUserAccount != null && Presenter.CurrentUserAccount.UserAccountRecordList != null && Presenter.CurrentUserAccount.UserAccountRecordList.Count > 0)
                {
                    Presenter.CurrentUserAccount.SelectedUserAccountRecord = Presenter.CurrentUserAccount.UserAccountRecordList[0];
                }
                return(true);
            }
            else
            {
                if (RecordListResponse.ErrorResponse != null)
                {
                    Presenter.TextEditorViewModel.FormatType = Extensions.AvalonEditSyntaxTypes.None;
                    Presenter.TextEditorViewModel.Text       = RecordListResponse.ErrorResponse.Description;
                    return(false);
                }
                else
                {
                    Presenter.TextEditorViewModel.FormatType = Extensions.AvalonEditSyntaxTypes.None;
                    Presenter.TextEditorViewModel.Text       = $"Unknown Error, Status code {RecordListResponse.StatusCode.ToString()}";
                    return(false);
                }
            }
        }
        public void Test_GetRecordList(string RefreshToken)
        {
            //Arrange
            Uri     FhirGatewayEndpoint = new Uri("https://apinams.ehealthvendortest.health.gov.au");
            FhirApi Api = new FhirApi(FhirGatewayEndpoint);

            Api.Format = FhirApi.FhirFormat.Xml;
            //Act
            RecordListResponse RecordListResponse = Api.GetRecordList();

            //Assert
            Assert.Equal(RecordListResponse.StatusCode, System.Net.HttpStatusCode.OK);
            Assert.Equal(RecordListResponse.Format, FhirApi.FhirFormat.Xml);
            Assert.NotNull(RecordListResponse.Body);
            Assert.Null(RecordListResponse.ErrorResponse);
        }
示例#5
0
        private RecordListResponse ReadRecordList(Entity entity, RecordList recordList)
        {
            RecordListResponse response = new RecordListResponse
            {
                Success = true,
                Message = "The list was successfully returned!",
            };

            try
            {
                response.Object = recordList;
            }
            catch (Exception e)
            {
                response.Timestamp = DateTime.UtcNow;
                response.Success = false;
            #if DEBUG
                response.Message = e.Message + e.StackTrace;
            #else
                response.Message = "An internal error occurred!";
            #endif
                return response;
            }

            response.Timestamp = DateTime.Now;

            return response;
        }
示例#6
0
        private RecordListResponse CreateRecordList(Entity entity, InputRecordList inputRecordList)
        {
            RecordListResponse response = new RecordListResponse
            {
                Success = true,
                Message = "The list was successfully created!",
            };

            if (!inputRecordList.Id.HasValue)
                inputRecordList.Id = Guid.NewGuid();

            RecordList recordList = inputRecordList.MapTo<RecordList>();

            try
            {
                response.Object = recordList;
                response.Errors = ValidateRecordList(entity, inputRecordList, false);

                recordList = inputRecordList.MapTo<RecordList>();

                if (response.Errors.Count > 0)
                {
                    response.Timestamp = DateTime.UtcNow;
                    response.Success = false;
                    response.Message = "The list was not created. Validation error occurred!";
                    return response;
                }

                entity.RecordLists.Add(recordList);

                IStorageEntity updatedEntity = entity.MapTo<IStorageEntity>();
                bool result = EntityRepository.Update(updatedEntity);
                if (!result)
                {
                    response.Timestamp = DateTime.UtcNow;
                    response.Success = false;
                    response.Message = "The list was not created! An internal error occurred!";
                    return response;
                }

            }
            catch (Exception e)
            {
                response.Success = false;
                response.Object = recordList;
                response.Timestamp = DateTime.UtcNow;
            #if DEBUG
                response.Message = e.Message + e.StackTrace;
            #else
                response.Message = "The list was not created. An internal error occurred!";
            #endif
                return response;
            }

            return ReadRecordList(entity.Id, recordList.Id);
        }
示例#7
0
        public RecordListResponse UpdateRecordList(Entity entity, InputRecordList inputRecordList)
        {
            RecordListResponse response = new RecordListResponse
            {
                Success = true,
                Message = "The list was successfully updated!",
            };

            RecordList recordList = inputRecordList.MapTo<RecordList>();

            try
            {
                response.Object = recordList;
                response.Errors = ValidateRecordList(entity, inputRecordList, true);

                recordList = inputRecordList.MapTo<RecordList>();

                if (response.Errors.Count > 0)
                {
                    response.Timestamp = DateTime.UtcNow;
                    response.Success = false;
                    response.Message = "The list was not updated. Validation error occurred!";
                    return response;
                }

                RecordList listForDelete = entity.RecordLists.FirstOrDefault(r => r.Id == recordList.Id);
                if (listForDelete.Id == recordList.Id)
                    entity.RecordLists.Remove(listForDelete);

                entity.RecordLists.Add(recordList);

                IStorageEntity updatedEntity = entity.MapTo<IStorageEntity>();
                bool result = EntityRepository.Update(updatedEntity);
                if (!result)
                {
                    response.Timestamp = DateTime.UtcNow;
                    response.Success = false;
                    response.Message = "The list was not updated! An internal error occurred!";
                    return response;
                }

            }
            catch (Exception e)
            {
                response.Success = false;
                response.Object = recordList;
                response.Timestamp = DateTime.UtcNow;
            #if DEBUG
                response.Message = e.Message + e.StackTrace;
            #else
                response.Message = "The list was not updated. An internal error occurred!";
            #endif
                return response;
            }

            return ReadRecordList(entity.Id, recordList.Id);
        }
示例#8
0
        public RecordListResponse ReadRecordList(string entityName, string name)
        {
            RecordListResponse response = new RecordListResponse();

            EntityResponse entityResponse = ReadEntity(entityName);

            if (!entityResponse.Success)
            {
                response.Timestamp = DateTime.UtcNow;
                response.Success = false;
                response.Message = entityResponse.Message;
                return response;
            }
            else if (entityResponse.Object == null)
            {
                response.Timestamp = DateTime.UtcNow;
                response.Success = false;
                response.Message = "Entity with such name does not exist!";
                return response;
            }

            Entity entity = entityResponse.Object;

            RecordList recordList = entity.RecordLists.FirstOrDefault(r => r.Name == name);

            if (recordList == null)
            {
                response.Timestamp = DateTime.UtcNow;
                response.Success = false;
                response.Message = "Record List with such Name does not exist!";
                return response;
            }

            return ReadRecordList(entity, recordList);
        }
示例#9
0
        public RecordListResponse ReadRecordList(Guid entityId, Guid id)
        {
            RecordListResponse response = new RecordListResponse();

            EntityResponse entityResponse = ReadEntity(entityId);

            if (!entityResponse.Success)
            {
                response.Timestamp = DateTime.UtcNow;
                response.Success = false;
                response.Message = entityResponse.Message;
                return response;
            }
            else if (entityResponse.Object == null)
            {
                response.Timestamp = DateTime.UtcNow;
                response.Success = false;
                response.Message = "Entity with such Id does not exist!";
                return response;
            }

            Entity entity = entityResponse.Object;

            RecordList recordList = entity.RecordLists.FirstOrDefault(r => r.Id == id);

            if (recordList == null)
            {
                response.Timestamp = DateTime.UtcNow;
                response.Success = false;
                response.Message = "Record List with such Id does not exist!";
                return response;
            }

            return ReadRecordList(entity, recordList);
        }
示例#10
0
        public IActionResult CreateRecordTreeByName(string entityName, [FromBody]JObject submitObj)
        {
            RecordListResponse response = new RecordListResponse();

            InputRecordTree tree = new InputRecordTree();
            try
            {
                tree = InputRecordTree.Convert(submitObj);
            }
            catch (Exception e)
            {
                return DoBadRequestResponse(response, "Input object is not in valid format! It cannot be converted.", e);
            }

            return DoResponse(entMan.CreateRecordTree(entityName, tree));
        }
示例#11
0
        public RecordListResponse DeleteRecordList(Guid entityId, Guid id)
        {
            RecordListResponse response = new RecordListResponse
            {
                Success = true,
                Message = "The list was successfully deleted!",
            };

            try
            {
                var entityResponse = ReadEntity(entityId);

                if (!entityResponse.Success)
                {
                    response.Timestamp = DateTime.UtcNow;
                    response.Success = false;
                    response.Message = entityResponse.Message;
                    return response;
                }
                else if (entityResponse.Object == null)
                {
                    response.Timestamp = DateTime.UtcNow;
                    response.Success = false;
                    response.Message = "Entity with such Id does not exist!";
                    return response;
                }
                Entity entity = entityResponse.Object;

                RecordList recordList = entity.RecordLists.FirstOrDefault(v => v.Id == id);

                if (recordList == null)
                {
                    response.Timestamp = DateTime.UtcNow;
                    response.Success = false;
                    response.Message = "The list was not deleted. Validation error occurred!";
                    response.Errors.Add(new ErrorModel("id", id.ToString(), "List with such Id does not exist!"));
                    return response;
                }

                entity.RecordLists.Remove(recordList);

                DbEntity updatedEntity = entity.MapTo<DbEntity>();
                bool result = DbContext.Current.EntityRepository.Update(updatedEntity);
                if (!result)
                {
                    Cache.ClearEntities();
                    response.Timestamp = DateTime.UtcNow;
                    response.Success = false;
                    response.Message = "The list was not updated! An internal error occurred!";
                    return response;
                }
            }
            catch (Exception e)
            {
                Cache.ClearEntities();
                response.Timestamp = DateTime.UtcNow;
                response.Success = false;
            #if DEBUG
                response.Message = e.Message + e.StackTrace;
            #else
                response.Message = "The list was not deleted. An internal error occurred!";
            #endif
                return response;
            }

            Cache.ClearEntities();

            response.Timestamp = DateTime.UtcNow;
            return response;
        }
示例#12
0
        public IActionResult CreateRecordListByName(string Name, [FromBody]JObject submitObj)
        {
            RecordListResponse response = new RecordListResponse();

            InputRecordList list = new InputRecordList();
            try
            {
                list = InputRecordList.Convert(submitObj);
            }
            catch (Exception e)
            {
                return DoBadRequestResponse(response, "Input object is not in valid format! It cannot be converted.", e);
            }

            return DoResponse(entityManager.CreateRecordList(Name, list));
        }
示例#13
0
        /// <summary>
        /// Function to update a domain in Gandi
        /// </summary>
        /// <param name="domain">domain name</param>
        /// <param name="apikey">The Gandi api key</param>
        /// <returns>a message in case of error</returns>
        public static string UpdateDomainGandi(string domain, string apikey)
        {
            //Read ip
            //https://api.ipify.org?format=json
            //https://api.myip.com
            //https://ip.seeip.org/jsonip?
            // brute
            //http://ipv4bot.whatismyipaddress.com/
            string ip = GetIPJson("https://api.ipify.org?format=json");

            if (string.IsNullOrEmpty(ip))
            {
                ip = GetIPJson("https://api.myip.com");
            }
            if (string.IsNullOrEmpty(ip))
            {
                ip = GetIPJson("https://ip.seeip.org/jsonip?");
            }
            if (string.IsNullOrEmpty(ip))
            {
                ip = GetIP("http://ipv4bot.whatismyipaddress.com/");
            }

            using (ManagerZone GandiZone = new ManagerZone("https://dns.api.gandi.net/api/v5/", apikey))
                using (ManagerDomain GandiDomain = new ManagerDomain("https://dns.api.gandi.net/api/v5/", apikey))
                {
                    DomainDetailResponse rep = GandiDomain.GetDetail(domain);
                    if (rep.ErrorMessage != null)
                    {
                        return("Error occurs on getting domain :" + domain + " \r\nError:" + rep.ErrorMessage.GetMessage());
                    }

                    RecordListResponse rec = GandiZone.GetAllRecords(rep.Data.Domain.ZoneUuid);
                    if (rec.ErrorMessage != null)
                    {
                        return("Error occurs on getting Record of zone :" + rep.Data.Domain.ZoneUuid + " \r\nError:" + rec.ErrorMessage.GetMessage());
                    }

                    //find record and modify it if different
                    foreach (RecordDto r in rec.Data.Records)
                    {
                        if (r.RrsetName == "@" && r.RrsetType == "A")
                        {
                            string before = string.Empty;
                            foreach (string s in r.RrsetValues)
                            {
                                before += s + " ";
                                if (s == ip)
                                {
                                    return(string.Empty);
                                }
                            }

                            r.RrsetValues = new List <string>()
                            {
                                ip
                            };
                            ZoneUpdateResponse zu = GandiZone.UpdateOneRecords(rep.Data.Domain.ZoneUuid, "@", "A", r);
                            if (rec.ErrorMessage != null)
                            {
                                return("Error occurs on update Record @ A with ip :" + ip + " of zone :" + rep.Data.Domain.ZoneUuid + " \r\nError:" + rec.ErrorMessage.GetMessage());
                            }
                        }
                    }
                }

            return(string.Empty);
        }
示例#14
0
        public IActionResult PatchRecordListByName(string Name, string ListName, [FromBody]JObject submitObj)
        {
            RecordListResponse response = new RecordListResponse();
            Entity entity = new Entity();
            InputRecordList list = new InputRecordList();

            try
            {
                IStorageEntity storageEntity = Storage.GetEntityRepository().Read(Name);
                if (storageEntity == null)
                {
                    response.Timestamp = DateTime.UtcNow;
                    response.Success = false;
                    response.Message = "Entity with such Name does not exist!";
                    return DoBadRequestResponse(response);
                }
                entity = storageEntity.MapTo<Entity>();

                RecordList updatedList = entity.RecordLists.FirstOrDefault(l => l.Name == ListName);
                if (updatedList == null)
                {
                    response.Timestamp = DateTime.UtcNow;
                    response.Success = false;
                    response.Message = "List with such Name does not exist!";
                    return DoBadRequestResponse(response);
                }
                list = updatedList.MapTo<InputRecordList>();

                Type inputListType = list.GetType();

                foreach (var prop in submitObj.Properties())
                {
                    int count = inputListType.GetProperties().Where(n => n.Name.ToLower() == prop.Name.ToLower()).Count();
                    if (count < 1)
                        response.Errors.Add(new ErrorModel(prop.Name, prop.Value.ToString(), "Input object contains property that is not part of the object model."));
                }

                if (response.Errors.Count > 0)
                    return DoBadRequestResponse(response);

                InputRecordList inputList = InputRecordList.Convert(submitObj);

                foreach (var prop in submitObj.Properties())
                {

                    if (prop.Name.ToLower() == "label")
                        list.Label = inputList.Label;
                    if (prop.Name.ToLower() == "default")
                        list.Default = inputList.Default;
                    if (prop.Name.ToLower() == "system")
                        list.System = inputList.System;
                    if (prop.Name.ToLower() == "weight")
                        list.Weight = inputList.Weight;
                    if (prop.Name.ToLower() == "cssclass")
                        list.CssClass = inputList.CssClass;
                    if (prop.Name.ToLower() == "type")
                        list.Type = inputList.Type;
                    if (prop.Name.ToLower() == "pagesize")
                        list.PageSize = inputList.PageSize;
                    if (prop.Name.ToLower() == "columns")
                        list.Columns = inputList.Columns;
                    if (prop.Name.ToLower() == "query")
                        list.Query = inputList.Query;
                    if (prop.Name.ToLower() == "sorts")
                        list.Sorts = inputList.Sorts;
                }
            }
            catch (Exception e)
            {
                return DoBadRequestResponse(response, "Input object is not in valid format! It cannot be converted.", e);
            }

            return DoResponse(entityManager.UpdateRecordList(entity, list));
        }
示例#15
0
        public RecordListResponse CreateRecordList(string entityName, InputRecordList inputRecordList)
        {
            RecordListResponse response = new RecordListResponse();

            IStorageEntity storageEntity = EntityRepository.Read(entityName);

            if (storageEntity == null)
            {
                response.Timestamp = DateTime.UtcNow;
                response.Success = false;
                response.Message = "Entity with such name does not exist!";
                return response;
            }

            Entity entity = storageEntity.MapTo<Entity>();

            return CreateRecordList(entity, inputRecordList);
        }
示例#16
0
        public IActionResult PatchRecordListByName(string Name, string ListName, [FromBody]JObject submitObj)
        {
            RecordListResponse response = new RecordListResponse();
            Entity entity = new Entity();
            InputRecordList list = new InputRecordList();

            try
            {
                var entResp = new EntityManager().ReadEntity(Name);
                if (entResp.Object == null)
                {
                    response.Timestamp = DateTime.UtcNow;
                    response.Success = false;
                    response.Message = "Entity with such Name does not exist!";
                    return DoBadRequestResponse(response);
                }
                entity = entResp.Object;

                RecordList updatedList = entity.RecordLists.FirstOrDefault(l => l.Name == ListName);
                if (updatedList == null)
                {
                    response.Timestamp = DateTime.UtcNow;
                    response.Success = false;
                    response.Message = "List with such Name does not exist!";
                    return DoBadRequestResponse(response);
                }
                list = updatedList.MapTo<InputRecordList>();

                Type inputListType = list.GetType();

                foreach (var prop in submitObj.Properties())
                {
                    int count = inputListType.GetProperties().Where(n => n.Name.ToLower() == prop.Name.ToLower()).Count();
                    if (count < 1)
                        response.Errors.Add(new ErrorModel(prop.Name, prop.Value.ToString(), "Input object contains property that is not part of the object model."));
                }

                if (response.Errors.Count > 0)
                    return DoBadRequestResponse(response);

                InputRecordList inputList = InputRecordList.Convert(submitObj);

                foreach (var prop in submitObj.Properties())
                {

                    if (prop.Name.ToLower() == "label")
                        list.Label = inputList.Label;
                    if (prop.Name.ToLower() == "title")
                        list.Title = inputList.Title;
                    if (prop.Name.ToLower() == "default")
                        list.Default = inputList.Default;
                    if (prop.Name.ToLower() == "system")
                        list.System = inputList.System;
                    if (prop.Name.ToLower() == "weight")
                        list.Weight = inputList.Weight;
                    if (prop.Name.ToLower() == "cssclass")
                        list.CssClass = inputList.CssClass;
                    if (prop.Name.ToLower() == "type")
                        list.Type = inputList.Type;
                    if (prop.Name.ToLower() == "pagesize")
                        list.PageSize = inputList.PageSize;
                    if (prop.Name.ToLower() == "columns")
                        list.Columns = inputList.Columns;
                    if (prop.Name.ToLower() == "query")
                        list.Query = inputList.Query;
                    if (prop.Name.ToLower() == "sorts")
                        list.Sorts = inputList.Sorts;
                    if (prop.Name.ToLower() == "iconname")
                        list.IconName = inputList.IconName;
                    if (prop.Name.ToLower() == "visiblecolumnscount")
                        list.VisibleColumnsCount = inputList.VisibleColumnsCount;
                    if (prop.Name.ToLower() == "dynamichtmltemplate")
                        list.DynamicHtmlTemplate = inputList.DynamicHtmlTemplate;
                    if (prop.Name.ToLower() == "datasourceurl")
                        list.DataSourceUrl = inputList.DataSourceUrl;
                    if (prop.Name.ToLower() == "columnwidthscsv")
                        list.ColumnWidthsCSV = inputList.ColumnWidthsCSV;
                    if (prop.Name.ToLower() == "actionitems")
                        list.ActionItems = inputList.ActionItems;
                    if (prop.Name.ToLower() == "servicecode")
                        list.ServiceCode = inputList.ServiceCode;
                }
            }
            catch (Exception e)
            {
                return DoBadRequestResponse(response, "Input object is not in valid format! It cannot be converted.", e);
            }

            return DoResponse(entMan.UpdateRecordList(entity, list));
        }
示例#17
0
        public RecordListResponse CreateRecordList(string entityName, InputRecordList inputRecordList)
        {
            RecordListResponse response = new RecordListResponse();

            var entityResponse = ReadEntity(entityName);

            if (!entityResponse.Success)
            {
                response.Timestamp = DateTime.UtcNow;
                response.Success = false;
                response.Message = entityResponse.Message;
                return response;
            }
            else if (entityResponse.Object == null)
            {
                response.Timestamp = DateTime.UtcNow;
                response.Success = false;
                response.Message = "Entity with such Id does not exist!";
                return response;
            }

            Entity entity = entityResponse.Object;

            return CreateRecordList(entity, inputRecordList);
        }
示例#18
0
        public IActionResult UpdateRecordTreeByName(string entityName, string treeName, [FromBody]JObject submitObj)
        {
            RecordListResponse response = new RecordListResponse();

            InputRecordTree tree = new InputRecordTree();

            Type inputViewType = tree.GetType();

            foreach (var prop in submitObj.Properties())
            {
                int count = inputViewType.GetProperties().Where(n => n.Name.ToLower() == prop.Name.ToLower()).Count();
                if (count < 1)
                    response.Errors.Add(new ErrorModel(prop.Name, prop.Value.ToString(), "Input object contains property that is not part of the object model."));
            }

            if (response.Errors.Count > 0)
                return DoBadRequestResponse(response);

            try
            {
                tree = InputRecordTree.Convert(submitObj);
            }
            catch (Exception e)
            {
                return DoBadRequestResponse(response, "Input object is not in valid format! It cannot be converted.", e);
            }

            return DoResponse(entMan.UpdateRecordTree(entityName, tree));
        }
示例#19
0
        public RecordListResponse DeleteRecordList(string entityName, string name)
        {
            RecordListResponse response = new RecordListResponse
            {
                Success = true,
                Message = "The list was successfully deleted!",
            };

            try
            {
                IStorageEntity storageEntity = EntityRepository.Read(entityName);

                if (storageEntity == null)
                {
                    response.Timestamp = DateTime.UtcNow;
                    response.Success = false;
                    response.Message = "Entity with such Name does not exist!";
                    return response;
                }

                Entity entity = storageEntity.MapTo<Entity>();

                RecordList recordList = entity.RecordLists.FirstOrDefault(l => l.Name == name);

                if (recordList == null)
                {
                    response.Timestamp = DateTime.UtcNow;
                    response.Success = false;
                    response.Message = "The list was not deleted. Validation error occurred!";
                    response.Errors.Add(new ErrorModel("name", name, "List with such Name does not exist!"));
                    return response;
                }

                entity.RecordLists.Remove(recordList);

                IStorageEntity updatedEntity = entity.MapTo<IStorageEntity>();
                bool result = EntityRepository.Update(updatedEntity);
                if (!result)
                {
                    response.Timestamp = DateTime.UtcNow;
                    response.Success = false;
                    response.Message = "The list was not updated! An internal error occurred!";
                    return response;
                }
            }
            catch (Exception e)
            {
                response.Timestamp = DateTime.UtcNow;
                response.Success = false;
            #if DEBUG
                response.Message = e.Message + e.StackTrace;
            #else
                response.Message = "The list was not deleted. An internal error occurred!";
            #endif
                return response;
            }

            response.Timestamp = DateTime.UtcNow;
            return response;
        }