🎨 fixed after feedback
This commit is contained in:
parent
e7d8ff1e34
commit
c5c8194fed
1 changed files with 10 additions and 10 deletions
|
@ -98,9 +98,9 @@ public class MovieController: ControllerBase
|
||||||
_context.Add(newMovie);
|
_context.Add(newMovie);
|
||||||
_context.SaveChanges();
|
_context.SaveChanges();
|
||||||
return Ok("Successfully added new movie");
|
return Ok("Successfully added new movie");
|
||||||
} else {
|
|
||||||
return StatusCode(409, "Conflict, imdbID already exists");
|
|
||||||
}
|
}
|
||||||
|
return StatusCode(409, "Conflict, imdbID already exists");
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -115,14 +115,14 @@ public class MovieController: ControllerBase
|
||||||
{
|
{
|
||||||
var movie = _context.Movies.AsEnumerable()
|
var movie = _context.Movies.AsEnumerable()
|
||||||
.Where(m => m.imdbID.ToLower().Contains(imdbID.ToLower()))
|
.Where(m => m.imdbID.ToLower().Contains(imdbID.ToLower()))
|
||||||
.ElementAtOrDefault(0);
|
.SingleOrDefault();
|
||||||
if (movie != null) {
|
if (movie != null) {
|
||||||
_context.Remove(movie);
|
_context.Remove(movie);
|
||||||
_context.SaveChanges();
|
_context.SaveChanges();
|
||||||
return Ok("Successfully deleted movie");
|
return Ok("Successfully deleted movie");
|
||||||
} else {
|
|
||||||
return StatusCode(409, "Conflict, imdbID doesn't exists");
|
|
||||||
}
|
}
|
||||||
|
return StatusCode(409, "Conflict, imdbID doesn't exists");
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -143,7 +143,7 @@ public class MovieController: ControllerBase
|
||||||
{
|
{
|
||||||
var movie = _context.Movies.AsEnumerable()
|
var movie = _context.Movies.AsEnumerable()
|
||||||
.Where(m => m.imdbID.ToLower().Contains(imdbID.ToLower()))
|
.Where(m => m.imdbID.ToLower().Contains(imdbID.ToLower()))
|
||||||
.ElementAtOrDefault(0);
|
.SingleOrDefault();
|
||||||
if (movie != null) {
|
if (movie != null) {
|
||||||
if (s != null) movie.Title = s;
|
if (s != null) movie.Title = s;
|
||||||
if (y != null) movie.Year = y;
|
if (y != null) movie.Year = y;
|
||||||
|
@ -151,9 +151,9 @@ public class MovieController: ControllerBase
|
||||||
if (poster != null) movie.Poster = poster;
|
if (poster != null) movie.Poster = poster;
|
||||||
_context.SaveChanges();
|
_context.SaveChanges();
|
||||||
return Ok("Successfully edited movie");
|
return Ok("Successfully edited movie");
|
||||||
} else {
|
|
||||||
return StatusCode(409, "Conflict, imdbID doesn't exists");
|
|
||||||
}
|
}
|
||||||
|
return StatusCode(404, "Conflict, imdbID doesn't exists");
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
Reference in a new issue