This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CollectionViewModel | |
{ | |
public int? Id { get; set; } | |
public string Name { get; set; } | |
public string Description { get; set; } | |
public bool Published { get; set; } | |
public HttpPostedFileBase ThumbnailFile { get; set; } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Drawing.Drawing2D; | |
using System.Drawing.Imaging; | |
using System.Linq; | |
using System.Web; | |
using System.Drawing; | |
namespace Utilities | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Html.ActionLink("Delete", "Delete", "tag", new { category.Id }, new { @class = "btn btn-danger delete", @id = "delete-" + category.Id, @data_delete = category.Id }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Html.ActionLink("Edit", "Edit", "tag", new { category.Id }, new { @class = "btn btn-success" }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// if our viewmodel has an ID then grab that entity... otherwise create a new one | |
var collection = collectionDto.Id.HasValue ? _collectionRepository.Get(collectionDto.Id.Value) : new Collection(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public int Save(CollectionViewModel collectionModel) | |
{ | |
var collection = collectionModel.Id.HasValue ? _collectionRepository.Get(collectionModel.Id.Value) : new Collection(); | |
collection.Name = collectionModel.Name; | |
collection.Published = collectionModel.Published; | |
collection.Featured = collectionModel.Featured; | |
collection.Description = collectionModel.Description; | |
_collectionRepository.Save(collection); | |
return collection.Id; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HttpPost] | |
public ActionResult Edit(CollectionViewModel model) | |
{ | |
if (ModelState.IsValid) | |
{ | |
var id = _collectionModel.Save(model); | |
} | |
return View(model); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@model ViewModels.CollectionViewModel | |
@{ | |
string actionKeyword = ViewData["ActionKeyword"].ToString(); | |
} | |
@using (Html.BeginForm("edit", "collection", FormMethod.Post, new { enctype = "multipart/form-data" })) | |
{ | |
<label class="control-label">Name:</label> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@model ViewModels.CollectionViewModel | |
@{ | |
Layout = “~/Views/Shared/Layout.cshtml”; | |
} | |
@section AdditionalHeadContent { | |
<script> | |
$(document).ready(function () {}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function handle_delete_listing( $post_id ) | |
{ | |
$cargs = array( | |
'post_type' => 'attachment', | |
'post_parent' => $post_id | |
); | |
$attachments = get_children($cargs); | |
if ($attachments) { |