forked from ddrilling/AsbCloudServer
Merge pull request 'Добавить валидацию id категории операции >= 5000.' (#58) from feature/deny-category-choose into dev
Reviewed-on: http://test.digitaldrilling.ru:8080/DDrilling/AsbCloudServer/pulls/58
This commit is contained in:
commit
b05fa001c3
@ -9,9 +9,6 @@ namespace AsbCloudApp.Data
|
||||
/// </summary>
|
||||
public class WellOperationDto : ItemInfoDto, IId, IWellRelated
|
||||
{
|
||||
|
||||
|
||||
|
||||
/// <inheritdoc/>
|
||||
public int Id { get; set; }
|
||||
|
||||
@ -34,6 +31,7 @@ namespace AsbCloudApp.Data
|
||||
/// id категории операции
|
||||
/// </summary>
|
||||
[Required]
|
||||
[Range(5000, int.MaxValue)]
|
||||
public int IdCategory { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -45,6 +45,7 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
|
||||
if (categories is null)
|
||||
{
|
||||
categories = db.WellOperationCategories
|
||||
.Where(c => c.Id >= 5000)
|
||||
.AsNoTracking()
|
||||
.ToList();
|
||||
}
|
||||
@ -299,7 +300,7 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
|
||||
{
|
||||
var category = Categories.Find(c => c.Name.ToLower() == categoryName.ToLower());
|
||||
if (category is null)
|
||||
throw new FileFormatException($"Лист {row.Worksheet.Name}. Строка {row.RowNumber()} указана некорректная операция");
|
||||
throw new FileFormatException($"Лист {row.Worksheet.Name}. Строка {row.RowNumber()} указана некорректная операция ({categoryName})");
|
||||
|
||||
operation.IdCategory = category.Id;
|
||||
operation.CategoryName = category.Name;
|
||||
|
@ -1,4 +1,5 @@
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Exceptions;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Requests;
|
||||
using AsbCloudApp.Services;
|
||||
@ -9,6 +10,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@ -202,7 +204,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<WellOperationDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> InsertRangeAsync(
|
||||
[Range(1, int.MaxValue, ErrorMessage = "Id скважины не может быть меньше 1")] int idWell,
|
||||
[Range(1, int.MaxValue, ErrorMessage = "Id скважины не может быть меньше 1")] int idWell,
|
||||
[FromBody] IEnumerable<WellOperationDto> values,
|
||||
CancellationToken token)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user